The thing I am seeing is if I call the worker 10 times then 4 of the times do
not execute. I have a state variable to the DB record. I set the state to 1
when ceding it to the server. Then the server sets it to 3 when it calls the
worker. The worker then sets it to 0 when it’s done. Or 2 if its returning
partial information. (Like a thumbnail for the main program)
The ones that do not execute leave the status at 3 and never return. I can
trigger it to return by resetting the value to 1 and it will request the
worker. Each task is a separate record in the tasks table. This way row locking
does not get me.
This is now what Im looking at for each task to execute.
C_OBJECT($signalUploadPhoto)
$signalUploadPhoto:=New signal
$signalUploadPhoto.signaled:=True
Then I enter the loop. Inside the loop Have the following.
: ($currentRecord.reqType="Photo Add") //
If ($signalUploadPhoto.signaled=True)
$signalUploadPhoto.signaled:=False // Reset the signal to allow
execution
$currentRecord.reqStatus:=3 // Tag this as assigned
$currentRecord.save() // save save prior to executing.
CALL WORKER("Get Server Add
Photo";"Pict_AddPhoto";$currentRecord.reqID;$serviceSignal) // Call function
as a worker process.
End if
The docs day to call .wait($timeToWaitInSeconds) But that would stall the loop
defeating the benefits of preemptive processes and the threading. Is there a
more elegant way to do this? Also am I going to have to use the use command on
the Signal variable to change the values since it is a shared object?
> On Mar 25, 2019, at 4:36 PM, Jeffrey Kain via 4D_Tech <[email protected]>
> wrote:
>
> That's the point of workers.
>
> You queue up messages for the worker to handle, in order, so your calling
> method doesn't block.
>
>> On Mar 25, 2019, at 4:33 PM, Eric Naujock via 4D_Tech <[email protected]>
>> wrote:
>>
>> But I have found that my loop pushing photos to the server moves so fast it
>> outraces the call worker
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive: http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub: mailto:[email protected]
> **********************************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************