On Jul 10, 2019, at 5:41 PM, Booth Martin <booth@xxxxxxxxxxxx> wrote:
What is the best way, in SQLRPGLE, to delay the next RPG operation by 1.5 seconds?
I've found that I need to delay processing for a few reasonable reasons:
1) I'm in some sort of 'show the user updated status' loop
2) I'm in a 'I need a resource to shake loose' loop
sleep() is good enough for the first scenario, although there is a
school of thought that says that long running things should probably
not rub it in the end user's face that they are not getting productive
work accomplished by watching a green bar creep across the page...
In the second case, I've found that several (dozen) repetitions aren't
usually enough to release an object lock during backups, or release a
record lock when the locking job has literally left the building for
lunch. In these sorts of resource conflicts, it's almost always better
for me to find the root cause (programmatically) and let the end user
decide whether (and when) to try again, or abandon this attempt and go
do something else instead. I've come to regret using sleep() for these
resource conflict things. Now this is a lot easier when I own the
interface - 5250, but it gets a lot trickier when the end user is on a
web page, or is an Excel spreadsheet trying to read a record, or any
of a dozen new 'non-interactive' interfaces. But even with these,
there ought to be a way to gracefully let the... the consumer, the
other end point, know that a resource is not available for the moment.
And often enough, trying to negotiate that error message notification
with the far end is enough to trigger a conversation about ways to
make that resource contention go away. Like using SQL DELETE FROM...
instead of CLRPFM. That sort of thing.
--buck
As an Amazon Associate we earn from qualifying purchases.