Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Mojolicious and connection to a database

by frazap (Monk)
on May 03, 2019 at 13:02 UTC ( [id://1233317]=note: print w/replies, xml ) Need Help??


in reply to Re: Mojolicious and connection to a database
in thread Mojolicious and connection to a database

Well, loading the config file that way is to make sure the app works when packed with pp. It's no big deal once it's tested.

My question was more in relation with remembering the connection done using the hash.

Could the connection be broken by the database server when the page has been load ? If yes, can I check this rather then using the hash value ?

Thanks for helping anyway !

  • Comment on Re^2: Mojolicious and connection to a database

Replies are listed 'Best First'.
Re^3: Mojolicious and connection to a database
by bliako (Monsignor) on May 04, 2019 at 08:05 UTC

    What if your database server crashes/shuts down/restarts after you run the plugin() to connect to it? %connections flag will not tell you that. In general, one can ping() prior to, or eval() on each db operation and catch the error if any. So perhaps convert this flag to a sub which pings the db-handle you think you have and return the result. See check if DBI is still connected.

Re^3: Mojolicious and connection to a database
by trippledubs (Deacon) on May 03, 2019 at 14:26 UTC
    hmm.. maybe try testing by putting a load on the web server and see how many connections you have to the database? I would think if that part is not working right you would see either increasing number of connections to the database up to some ceiling or your pages not getting data from the database. If I understand your concern correctly.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-20 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found