Configuring SQLite to wait indefinitely
(1) By nchammas on 2021-10-26 17:37:33 [source]
Is there any way to configure
busy_timeout so that SQLite waits indefinitely?
I know I can set the timeout to
INT32_MAX milliseconds, which is roughly equal to 24.5 days of waiting. But I'm wondering if there is a more semantically direct way of saying "wait forever".
(2) By Ivan Tolstosheyev (itroot) on 2021-10-26 19:30:27 in reply to 1 [link] [source]
Curious, why do you need that? It is possible to get an example of an actual use-case?
(3) By Simon Slavin (slavin) on 2021-10-26 20:28:05 in reply to 1 [link] [source]
Define your own busy handler which does whatever you want:
You can, of course, copy the default one and modify it for your own purposes.
However, along with Ivan, I suspect something weird is going on if a pause of 24 days is not enough for your purposes. It might be to your advantage to tell us what you're really trying to do.
(4.1) By Scott Robison (casaderobison) on 2021-10-26 21:32:24 edited from 4.0 in reply to 3 [link] [source]
Based on the phrasing, it seems what is wanted is a "wait forever" that semantically says what is being sought vs "wait for a really long but finite time". Something that in code would be immediately obvious as the difference between "wait until something is available" and "wait until something is available or the timer elapses".
To that end, defining a custom busy handler would be the way to do that as described.
(5) By nchammas on 2021-10-27 16:38:33 in reply to 4.1 [link] [source]
Your understanding is correct. 24 days is obviously more than enough wait time. I was just looking for something that expressed "wait forever" more directly to the human reading the code.
Since I am using SQLite via the Python standard library, I don't think I can define a custom busy handler. I'll make do with the 24 days.
Thank you all for the responses.