mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-05 14:46:55 +01:00
Clarify restart-safe batches and scripted UI handler tests
Address Nikola's batching and UI-handler feedback on PR #132. Preserve existing false-positive guards and defer the unconfirmed IsHandled policy. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f841a18b-535a-498e-96f2-f279b5378da5
This commit is contained in:
parent
35d0966a8d
commit
0561b12c96
7 changed files with 155 additions and 46 deletions
|
|
@ -14,33 +14,35 @@ query 50127 "Perf Customer Chunk"
|
|||
|
||||
codeunit 50128 "Perf Sample CommitInLoop Good"
|
||||
{
|
||||
procedure NormalizeCustomerNames()
|
||||
procedure IncreaseCustomerCreditLimits()
|
||||
var
|
||||
NormalizeState: Record "Perf Normalize State";
|
||||
CreditLimitState: Record "Perf Credit Limit State";
|
||||
LastCustomerNo: Code[20];
|
||||
begin
|
||||
if not NormalizeState.Get('CUSTOMER') then begin
|
||||
NormalizeState.Init();
|
||||
NormalizeState.Code := 'CUSTOMER';
|
||||
NormalizeState.Insert();
|
||||
if not CreditLimitState.Get('CUSTOMER') then begin
|
||||
CreditLimitState.Init();
|
||||
CreditLimitState.Code := 'CUSTOMER';
|
||||
CreditLimitState.Insert();
|
||||
end;
|
||||
LastCustomerNo := NormalizeState."Last Customer No.";
|
||||
LastCustomerNo := CreditLimitState."Last Customer No.";
|
||||
|
||||
while NormalizeNextChunk(LastCustomerNo) do begin
|
||||
// Persist progress in the same transaction as the completed chunk.
|
||||
NormalizeState."Last Customer No." := LastCustomerNo;
|
||||
NormalizeState.Modify();
|
||||
while IncreaseNextChunk(LastCustomerNo) do begin
|
||||
CreditLimitState."Last Customer No." := LastCustomerNo;
|
||||
CreditLimitState.Modify();
|
||||
Commit();
|
||||
end;
|
||||
end;
|
||||
|
||||
local procedure NormalizeNextChunk(var LastCustomerNo: Code[20]): Boolean
|
||||
local procedure IncreaseNextChunk(var LastCustomerNo: Code[20]): Boolean
|
||||
var
|
||||
Customer: Record Customer;
|
||||
TempCustomer: Record Customer temporary;
|
||||
CustomerChunk: Query "Perf Customer Chunk";
|
||||
LastChunkCustomerNo: Code[20];
|
||||
ChunkStartedAt: DateTime;
|
||||
MaxChunkDuration: Duration;
|
||||
begin
|
||||
ChunkStartedAt := CurrentDateTime();
|
||||
MaxChunkDuration := 60000;
|
||||
CustomerChunk.TopNumberOfRows(500);
|
||||
if LastCustomerNo <> '' then
|
||||
CustomerChunk.SetFilter(CustomerNo, '>%1', LastCustomerNo);
|
||||
|
|
@ -49,7 +51,6 @@ codeunit 50128 "Perf Sample CommitInLoop Good"
|
|||
TempCustomer.Init();
|
||||
TempCustomer."No." := CustomerChunk.CustomerNo;
|
||||
TempCustomer.Insert();
|
||||
LastChunkCustomerNo := CustomerChunk.CustomerNo;
|
||||
end;
|
||||
CustomerChunk.Close();
|
||||
|
||||
|
|
@ -60,17 +61,17 @@ codeunit 50128 "Perf Sample CommitInLoop Good"
|
|||
if TempCustomer.FindSet() then
|
||||
repeat
|
||||
if Customer.Get(TempCustomer."No.") then begin
|
||||
Customer.Name := UpperCase(Customer.Name);
|
||||
Customer."Credit Limit (LCY)" += 100;
|
||||
Customer.Modify();
|
||||
end;
|
||||
until TempCustomer.Next() = 0;
|
||||
LastCustomerNo := TempCustomer."No.";
|
||||
until (TempCustomer.Next() = 0) or (CurrentDateTime() - ChunkStartedAt >= MaxChunkDuration);
|
||||
|
||||
LastCustomerNo := LastChunkCustomerNo;
|
||||
exit(true);
|
||||
end;
|
||||
}
|
||||
|
||||
table 50128 "Perf Normalize State"
|
||||
table 50128 "Perf Credit Limit State"
|
||||
{
|
||||
fields
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue