Created
March 18, 2020 14:53
-
-
Save zupzup/f65ce0e9c846ecb5c2b710adca9caa59 to your computer and use it in GitHub Desktop.
some_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