[Seaside] Long running tasks

Tobias Pape Das.Linux at gmx.de
Sun Mar 14 20:25:49 UTC 2021


Hi Aaron


> On 14. Mar 2021, at 21:06, Aaron Rosenzweig <aaron at chatnbike.com> wrote:
> 
> Thanks Tobias, 
> 
> That’s a great writeup - I like the looks of WADelayedAnswerDecoration discussed there too! Thanks for the tip. 

Glad to help.

For the last question you had,
do you mean something like
	Processor yield
or
	10 seconds delay wait
?

Best regards
	-Tobias

> 
> 
>> On Mar 14, 2021, at 3:17 PM, Tobias Pape <Das.Linux at gmx.de> wrote:
>> 
>> Hi
>> 
>>> On 14. Mar 2021, at 19:40, Aaron Rosenzweig <aaron at chatnbike.com> wrote:
>>> 
>>> Hi, 
>>> 
>>> Last I checked, Seaside is single-threaded which is a “good thing.” That said, it implies that every user action must return quickly… perhaps no longer than 1 second. If the action takes longer, a chain reaction starts to form from multiple “simultaneous” users (not really at-the-same-time users, they queue up with the single thread). There are times, in apps I’ve written, where the act of clicking a link (or button) is expected to take 10 minutes (sometimes half hour). During this time we want to fork a thread to do the big task (like generate a report) that doesn’t tie up the main thread. This way we can poll every 2 seconds to ask “are you done yet?” with a progress bar and then ultimately bring the user back to the normal flow. 
>> 
>> 
>> I've written something like that for SqueakSource3 about 10 years back.
>> 
>> The idea involved:
>> On Squeak (or Pharo)
>> 	- an ever running background Process with a loop and
>> 	- a shared queue and
>> 	- the Seaside-Processes putting work items there.
>> 	- the background process picks up items off that queue.
>> 
>> On GemStone:
>> 	- a separate "Service-Gem" that loops on a 
>> 	- shared (reduced-conflict) Queue
>> 	- the Seaside gem(s) committing items to that queue and
>> 	- the service gem handling them.
>> 
>> Dale Henrichs explained that bit quite well actually here:
>> 	https://github.com/GsDevKit/ServiceVM
>> 
>> Hope that helps.
>> 	-Tobias
>> 
>>> 
>>> Does Seaside have a pre-baked solution for this? 
>>> 
>>> If not, I’ll take Ramon’s lead as his posts are the only thing I’ve been able to find about the subject:
>>> http://onsmalltalk.com/polling-for-long-running-processes
>>> http://onsmalltalk.com/2010-07-28-a-simple-thread-pool-for-smalltalk
>>> 
>>> In his case, he wanted a page to load immediately but then have a handful (or more) ajax requests running in the background pinging other servers to tally prices for a travel quote site. Sort of like those interlaced GIF images back in the day, his page pops with basic information then progressively renders other parts. So his example has maybe 10 threads forked for one page to fully load and shows updates inline. 
>>> 
>>> I was thinking more of one page WAProgress (I made that up) with one forked thread that monitors its execution and returns when it either completes, errors, or the user clicks a cancel link. 
>>> 
>>> These are things baked into WebObjects (NeXT / Apple) and is what my buddies and I use daily. We are tiptoeing around the idea of starting new web development projects with Smalltalk / Seaside and testing the waters. 
>>> 
>>> I’ve setup a public demo app / repo to test out these concepts: 
>>> 
>>> https://github.com/recurve/ScriptaculistPharoHeySql/
>>> 
>>> It’s an address book application. What I’ll do is modify the delete of a contact to fork and render the Progress component and programmatically make the delete slow to show the feature. By the way, how do I do the equivalent of “Thread.sleep()” in Smalltalk? 
>>> 
>>> Thanks in advance for any advice you may have,
>>> — Aaron
>>> _______________________________________________
>>> seaside mailing list
>>> seaside at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> 
>> 
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> 
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




More information about the seaside mailing list