Slide 52
Slide 52 text
def busy_timeout(count)
delays = [1, 2, 5, 10, 15, 20, 25, 25, 25, 50, 50, 100]
if count < delays.size
delay = delays[count]
prior = delays.take(count).sum
else
delay = delays.last
prior = delays.sum + ((count - delays.size) * delay)
end
if prior + delay > timeout
raise SQLite3::BusyException
else
sleep delay.fdiv(1000)
end
end