Skip to content

Add overload to sheet appender to take batchinformation class, add an optional callback function - #56

Merged
SteveWinward merged 2 commits into
SteveWinward:mainfrom
drgrieve:main
Oct 10, 2026
Merged

SteveWinward merged 2 commits into
SteveWinward:mainfrom
drgrieve:main

Conversation

@drgrieve

ghost commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Adds an optional batch callback to support heartbeat signals during long-running sheet append operations. The callback runs between batches, allowing callers to report progress or cancel processing when needed without changing existing overload behavior.

Added AppendDataRecords helper function to reduce duplicated logic.

Tested against a sheet operation using AppendObject for 33K rows, split into batches of 500, with a 500ms wait time.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The callback and delay run after the final full batch when no additional records remain.

1 open finding
What changed in this PR

Adds shared batch configuration and cancellation callbacks to sheet append operations.

Changes:

  • Adds BatchInformation for batch settings and cancellation.
  • Consolidates CSV/object batching into a shared helper.
  • Preserves existing overloads.
File Description
SheetAppender.cs Adds overloads and shared batching logic.
BatchInformation.cs Defines batch configuration and callback.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +265 to +270
if (batchInformation.ShouldCancel?.Invoke() == true)
{
return;
}

Thread.Sleep(batchInformation.BatchWaitTime);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drgrieve, can you review the copilot suggestion and see if that update makes sense please?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that is an issue @SteveWinward.

I've add a unit test for SheetAppender and added a failing test to reproduce the issue.

Then added a fix for this.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@SteveWinward
SteveWinward merged commit 7f97526 into SteveWinward:main Oct 10, 2026
1 check failed
@SteveWinward

Copy link
Copy Markdown
Owner

@drgrieve I just released 2.0.28 with your changes. Thank you for the addition!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants