Hi,

Why do you need to run the check after few seconds?  We use this same kind of 
worker to write logs in files. As you said, the worker assure the file not to 
be opened. So in this contexte you know your file is accessible. You can still 
have an error handler to handle the case where there is an unexpected issue. We 
have a log table for those rare cases. 

I didn't try but a delay process should work in a worker but I would say it is 
not optimal as it will make the stack of the messages to wait seconds before to 
be processed. A worker should be fast so the next messages can be process 
quickly. But it depend on the number of log request you send to the worker. 

Gabriel Inzirillo. 

Envoyé de mon iPhone

> Le 13 mars 2019 à 22:15, Cannon Smith via 4D_Tech <4d_tech@lists.4d.com> a 
> écrit :
> 
> Hi Everyone,
> 
> I’m trying to do some quick and dirty logging to track down an issue at a 
> customer’s site. As part of that I need to log some information to a file, 
> always on the server. I figured the simplest would be to call a method each 
> time I need to log some information and pass the info to it. The method has 
> the Execute on Server property set so all logging happens on the server. I 
> don’t want anything tied up waiting for the logging to happen, so I have the 
> method call a worker process (on the server) and pass in the relevant 
> information to it. The worker is responsible to run some checks, ensure the 
> correct file exists, write the information to the file, and possibly send a 
> Slack message. Using a worker also ensures that a file is not being opened by 
> multiple processes at the same time.
> 
> So far all this works as hoped for and was simple to code. The problem is 
> that the worker process needs to run the checks a few seconds _after_ the 
> initial request to log information happened. Since the worker is just in a 
> cooperative process I figured I could add DELAY PROCESS. But it seems not to 
> work.
> 
> I could re-engineer the whole thing to use a background process in a loop on 
> the server and some IP arrays or a table, but was hoping to keep it simpler. 
> Does anyone know how to pause a worker process for a few seconds?
> 
> This is v17.1HF1.
> 
> Thanks.
> 
> --
> Cannon.Smith
> Synergy Farm Solutions Inc.
> Aetna, AB Canada
> <can...@synergyfarmsolutions.com>
> <www.synergyfarmsolutions.com>
> 
> 
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************


**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to