Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: How do I make a PSGI program do costly initialisation only once per process, not per thread?

by daxim (Curate)
on Jun 07, 2017 at 11:02 UTC ( [id://1192260]=note: print w/replies, xml ) Need Help??


in reply to Re^3: How do I make a PSGI program do costly initialisation only once per process, not per thread?
in thread How do I make a PSGI program do costly initialisation only once per process, not per thread?

comment out line #38 (loader => 'Delayed') in thrall.bat
You hit the nail on the head, bravo! So to make this crystal clear, the loader type is responsible for the difference in initialisation, not the server type itself, and with thrall, the delayed loading is on purpose.
Will this change to .bat break anything?
Yes, very much. It appears there is a lot of thread-unsafe code in my application. Let me show y'all a bizarre example:
use JSON qw(encode_json); my $app = sub { return [200, [], [encode_json [] ]] };
With plackup, the response is []. With thrall but no Delayed loader, the response is Internal Server Error, the exception hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this) at ….
  • Comment on Re^4: How do I make a PSGI program do costly initialisation only once per process, not per thread?
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1192260]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-20 01:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found