Jump to:

3373 Posts in 998 Topics by 712 members

Data Model Questions

SilverStripe Forums » Data Model Questions » DB connection timeout

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 288 Views
  • r0nn1ef
    Avatar
    Community Member
    6 Posts

    DB connection timeout Link to this post

    I've created a class that extends DailyTask to use for a cron job. What the task does is download several large files from a government bureau and insert those csv files into temp tables. Each function in the class works correctly, however, when I run them all together I start gettings errors saying "MySQL server has gone away." on simple DB::query() calls using insert statements. If, however, I remove the function to download the files (and manually upload the files to the proper directory), it executes without a problem and actually inserts the data into the temp tables.

    From what I have been able to find online, the MySQL error is most often caused by a timeout. Is there a way to delay the Silverstripe database connection until right before it's needed to allow the files to be downloaded from the remote FTP first? Or should I close the connection and reopen it right before needing it?

    I've attached a screenshot of my shell window when running the task with Sake. Any insight would be greatly appreciated.

    288 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.