开发者

Ruby mysql mysql2 AND datamapper how to reconnect

I have something running constantly doing periodic queries. I have used both DataMapper (though I'm doing raw SQL through it) and mysql2.

Using either, occasionally they stop working. I believe it's because the server hiccuped or something.

Nonetheless, everything grinds to a halt, then. Execution on each thread just stops at the query line and that's the end of that.

Is there a way to tell them to reconnect? Or, failing that, can I do it myself. I've been trying using timeout, but timeout seems to sort of freeze as well (it enters the block and never leaves, neither via raising an error nor through natural completion).

开发者_如何学Python

I simply want the queries, if they fail, to pass on by and on the next time around, try again, reconnecting to the server if necessary. How can I do this?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜