my outline for this would be as follows. I am not up to v16 yet, so this will be a 'classic' solution, use of call worker might simplify this.
write a deamon (a process which spends most of it's life asleep), is started at server startup. Deamon : repeat loop examine IP array, or Object for data to process if there is stuff to do do it remove processed item from Array/object if on a timed execution : Delay process(Delay time;Current process) if only as an on needed basis : Pause process(current process) until (Quit 4D) Add item to Array/object: (on client, adding) Execute on server : method with needed values Set semaphore to protect array/object add as needed clear semaphore wake deamon if (already running : wake (call process deamon process #)) else start deamon Remove Item from array/object (only runs on server, called from deamon): Set semaphore to protect array/object remove as needed clear semaphore Chip On Wed, 7 Nov 2018 00:40:41 +0000, Ben Sokal via 4D_Tech wrote: > Hello, > > Hoping someone can point me in the right direction as I've never done > something like this before. > > We have a multi-user environment running v16r5. Through various > means, a user can call a method that updates company-specific > financial data. The problem is that it can take 30+ seconds and the > user is left waiting until this finishes. What we want to do is this: > > - Return control to the user while the task runs in the background. > We want the task to run on the server instead of on the client > machine like it's currently doing. > - If this user or a different user runs the task again for the same > company, we need to queue it up somehow and do this after the > previous processing finishes. If this user or a different user runs > the task for a different company, we could either do the server > processing at the same time since there's no data conflict, or queue > it up if there is a risk of trying to do too many things at once. > > I've read the language manual and understand the syntax of > semaphores, which is what I'm thinking I need to use (but am not > completely sure). Beyond the syntax of commands, I don't know how to > implement this. For example if I'm doing an "execute on server", is > the semaphore going to be set on the client side before we call the > server to run its method, or is it the server method that does the > semaphore? Is this going to be a local semaphore or global? There are > transactions involved in the actual processing...does this impact at > all how I need to go about doing this? > > Thanks for any tips! > Ben > ********************************************************************** > 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 > ********************************************************************** --------------- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ********************************************************************** 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 **********************************************************************