macro_rules! retry { ($async_function:expr) => { ... }; }
This macro wraps a function with retry calls to keep calling the function until the error “database is locked” is not raised anymore.