Closed ewoolsey closed 7 months ago
tokio
and sqlx
. tokio
uses std::Duration but TIMESTAMPTZ
best maps to chrono::DateTime
so that sometimes gets converted into chrono::Duration
We actually don't need to delay it - we can have the tasks running without the tree initialised and throwing errors periodically - this would give us better visibility into the initialization period of the sequencer as these errors will show up in our monitoring
Ah yeah if this is the desired behaviour we can definitely do that. Are we sure we want to throw errors like this though? I usually try and stay away from logging an error when it's expected behaviour, sorta reduces the signal to noise of your errors and can be pretty noisy.
If you think that's the best route though then it's definitely the easiest to do correctly. I can work on that right now if that's what we wanna do.
I feel we should go this way - other option is to do tree initialisation as a separate flow/task but then we'll need to provide custom visibility into it.
We should treat prolonged tree initialisation as an error anyway imo - we should aim for it to be at most 10 seconds or something along those lines.
So yeah, let's do tree initialisation in a TaskMonitor task and have other tasks fail while the tree is uninitialised
This is a first draft of deferring tree initialization. I have some open TODOs here that I would like some feedback on.
Duration
are being used in different places. Is this intended? fromchrono
andstd
.TaskManager::start
until after the tree initialization. It's not clear what the best way to do this is. Multiple routes we could take.spawn_monitored_with_backoff