Examples fixed
This commit is contained in:
parent
f2ca0c046d
commit
ac45f36819
5 changed files with 13 additions and 13 deletions
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "simple_worker"
|
||||
name = "simple_cron_worker"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
@ -10,4 +10,4 @@ fang = { path = "../../../" , features = ["blocking"]}
|
|||
dotenv = "0.15.0"
|
||||
env_logger = "0.9.0"
|
||||
log = "0.4.0"
|
||||
diesel = "1.4.8"
|
||||
diesel = { version = "2", features = ["postgres", "r2d2"] }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use fang::runnable::Runnable;
|
||||
use fang::serde::{Deserialize, Serialize};
|
||||
use fang::typetag;
|
||||
use fang::Error;
|
||||
use fang::FangError;
|
||||
use fang::Queueable;
|
||||
use fang::Scheduled;
|
||||
|
||||
|
@ -11,7 +11,7 @@ pub struct MyCronTask {}
|
|||
|
||||
#[typetag::serde]
|
||||
impl Runnable for MyCronTask {
|
||||
fn run(&self, _queue: &dyn Queueable) -> Result<(), Error> {
|
||||
fn run(&self, _queue: &dyn Queueable) -> Result<(), FangError> {
|
||||
log::info!("CRON !!!!!!!!!!!!!!!!!");
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -5,7 +5,7 @@ use fang::Queue;
|
|||
use fang::Queueable;
|
||||
use fang::RetentionMode;
|
||||
use fang::WorkerPool;
|
||||
use simple_worker::MyCronTask;
|
||||
use simple_cron_worker::MyCronTask;
|
||||
use std::env;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "simple_worker"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
@ -10,4 +10,4 @@ fang = { path = "../../../" , features = ["blocking"]}
|
|||
dotenv = "0.15.0"
|
||||
env_logger = "0.9.0"
|
||||
log = "0.4.0"
|
||||
diesel = "1.4.8"
|
||||
diesel = { version = "2", features = ["postgres", "r2d2"] }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use fang::runnable::Runnable;
|
||||
use fang::serde::{Deserialize, Serialize};
|
||||
use fang::typetag;
|
||||
use fang::Error;
|
||||
use fang::FangError;
|
||||
use fang::Queueable;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
@ -27,9 +27,7 @@ impl MyTask {
|
|||
|
||||
#[typetag::serde]
|
||||
impl Runnable for MyTask {
|
||||
fn run(&self, queue: &dyn Queueable) -> Result<(), Error> {
|
||||
thread::sleep(Duration::from_secs(3));
|
||||
|
||||
fn run(&self, queue: &dyn Queueable) -> Result<(), FangError> {
|
||||
let new_task = MyTask::new(self.number + 1);
|
||||
|
||||
log::info!(
|
||||
|
@ -40,6 +38,8 @@ impl Runnable for MyTask {
|
|||
|
||||
queue.insert_task(&new_task).unwrap();
|
||||
|
||||
thread::sleep(Duration::from_secs(2));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ impl MyFailingTask {
|
|||
|
||||
#[typetag::serde]
|
||||
impl Runnable for MyFailingTask {
|
||||
fn run(&self, queue: &dyn Queueable) -> Result<(), Error> {
|
||||
fn run(&self, queue: &dyn Queueable) -> Result<(), FangError> {
|
||||
let new_task = MyFailingTask::new(self.number + 1);
|
||||
|
||||
queue.insert_task(&new_task).unwrap();
|
||||
|
|
Loading…
Reference in a new issue