Re: Delay Worker Process

2019-03-14 Thread Cannon Smith via 4D_Tech
Hi Gabriel,

Part of what gets logged isn’t know at the time I know something needs to be 
logged. The code is easiest if I can say, “Hey, please log this situation” and 
have the actual logging happen a few seconds later. As I said, this is a quick 
a dirty injection of some logging code to track down a bug. Not the normal 
thing.

However, I changed my method of doing this yesterday so I’m not using workers 
anymore. Just a background process and some interprocess arrays. Not the cool 
new way, but it does work.

Thanks.

--
Cannon.Smith
Synergy Farm Solutions Inc.
Aetna, AB Canada




> On Mar 14, 2019, at 1:03 AM, GI -AJAR  wrote:
> 
> 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. 
> 

**
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
**

Re: Delay Worker Process

2019-03-14 Thread GI -AJAR via 4D_Tech
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
> 
> 
> 
> 
> **
> 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
**