I have some updating code in a thread that updates the progress of a background job:
if FCurrentStep mod FUpdateStep = 0 then
begin
FJob.Progress := RoundTo(FCurrentStep / FTotalSteps * 100, -2);
FObjectManager.Update(FJob);
FObjectManager.Flush(FJob);
end;
The code does get called, but the data does not get updated in the table. Any ideas? thanks.
Was FJob object fetched from FObjectManager within the thread? Or is it a trancient object which is more likely since you call FObjectManager.Update(FJob) before Flush.
In this case Update call is not needed. Flush should be enough. But it should work, there is nothing unusual here. Have you debugged it? Are you sure the code is reaching that line of code? Do you have an open transaction and are you committing the transaction eventually?