[Seaside] Long running tasks

Aaron Rosenzweig aaron at chatnbike.com
Mon Mar 15 00:29:24 UTC 2021


Thanks Paul for the link to smalltalk hub with Ramon’s code from the blog post :-) 

Also thanks Tobias for the “10 seconds delay wait" syntax :-) That’s probably what I was looking for. I had seen a concurrency book for Pharo that talked about yield but that doesn’t pause the thread, just makes it lower priority. 

Thanks everyone :-)

> On Mar 14, 2021, at 6:44 PM, Paul DeBruicker <pdebruic at gmail.com> wrote:
> 
> http://smalltalkhub.com/pdebruic/ThreadPool/ <http://smalltalkhub.com/pdebruic/ThreadPool/>
> 
> Is the code from Ramon's blog post & works with Seaside and Pharo/GemStone
> and I think Squeak.
> 
> 
> 
> 
> 
> Aaron Rosenzweig 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. 
>> 
>> 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/polling-for-long-running-processes&gt <http://onsmalltalk.com/polling-for-long-running-processes&gt>;
>> http://onsmalltalk.com/2010-07-28-a-simple-thread-pool-for-smalltalk <http://onsmalltalk.com/2010-07-28-a-simple-thread-pool-for-smalltalk>
>> <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/ <https://github.com/recurve/ScriptaculistPharoHeySql/>
>> <https://github.com/recurve/ScriptaculistPharoHeySql/&gt <https://github.com/recurve/ScriptaculistPharoHeySql/&gt>;
>> 
>> 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 .squeakfoundation
> 
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
> 
> 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Seaside-General-f86180.html <http://forum.world.st/Seaside-General-f86180.html>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org <mailto:seaside at lists.squeakfoundation.org>
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20210314/aebe4437/attachment-0001.html>


More information about the seaside mailing list