Created
March 18, 2020 14:46
-
-
Save zupzup/37511496ca2403c1b1b76ef24b301349 to your computer and use it in GitHub Desktop.
test gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Clone)] | |
pub struct JobContext { | |
pub db_pool: DBPool, | |
pub redis_pool: RedisPool, | |
} | |
pub trait Job { | |
fn run(&self, ctx: &JobContext) -> JobResult; | |
fn get_interval(&self) -> Duration; | |
fn get_name(&self) -> &'static str; | |
fn get_sync_key(&self) -> &'static str; | |
fn box_clone(&self) -> BoxedJob; | |
} | |
impl Clone for Box<dyn Job> { | |
fn clone(&self) -> Box<dyn Job> { | |
self.box_clone() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment