Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fang from 0.9 to 0.10 #269

Merged
merged 2 commits into from
Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 25 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ chrono = "0.4"
diesel = { version = "2", features = ["postgres","r2d2"] }
dotenv = "0.15"
pretty_env_logger = "0.4"
fang = { version = "0.9", features = ["blocking"], default-features = false }
fang = { version = "0.10", features = ["blocking"], default-features = false }
feed-rs = "1"
frankenstein = { version = "0.20", default-features = false, features = ["telegram-trait"] }
handlebars = "4"
Expand Down
21 changes: 21 additions & 0 deletions migrations/2022-09-30-045157_modify_fang_tables/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
DROP TABLE fang_tasks;
DROP TYPE fang_task_state;

CREATE TYPE fang_task_state AS ENUM ('new', 'in_progress', 'failed', 'finished');

CREATE TABLE fang_tasks (
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
metadata jsonb NOT NULL,
error_message TEXT,
state fang_task_state DEFAULT 'new' NOT NULL,
task_type VARCHAR DEFAULT 'common' NOT NULL,
uniq_hash CHAR(64),
scheduled_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);

CREATE INDEX fang_tasks_state_index ON fang_tasks(state);
CREATE INDEX fang_tasks_type_index ON fang_tasks(task_type);
CREATE INDEX fang_tasks_scheduled_at_index ON fang_tasks(scheduled_at);
CREATE INDEX fang_tasks_uniq_hash ON fang_tasks(uniq_hash);
22 changes: 22 additions & 0 deletions migrations/2022-09-30-045157_modify_fang_tables/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
DROP TABLE fang_tasks;
DROP TYPE fang_task_state;

CREATE TYPE fang_task_state AS ENUM ('new', 'in_progress', 'failed', 'finished', 'retried');

CREATE TABLE fang_tasks (
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
metadata jsonb NOT NULL,
error_message TEXT,
state fang_task_state DEFAULT 'new' NOT NULL,
task_type VARCHAR DEFAULT 'common' NOT NULL,
uniq_hash CHAR(64),
retries INTEGER DEFAULT 0 NOT NULL,
scheduled_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);

CREATE INDEX fang_tasks_state_index ON fang_tasks(state);
CREATE INDEX fang_tasks_type_index ON fang_tasks(task_type);
CREATE INDEX fang_tasks_scheduled_at_index ON fang_tasks(scheduled_at);
CREATE INDEX fang_tasks_uniq_hash ON fang_tasks(uniq_hash);
4 changes: 4 additions & 0 deletions src/cleaner/clean_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ impl Runnable for CleanJob {
super::JOB_TYPE.to_string()
}

fn max_retries(&self) -> i32 {
0
}

fn cron(&self) -> Option<Scheduled> {
Some(Scheduled::CronPattern(Config::clean_cron_pattern()))
}
Expand Down
4 changes: 4 additions & 0 deletions src/cleaner/remove_old_items_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ impl Runnable for RemoveOldItemsJob {
true
}

fn max_retries(&self) -> i32 {
0
}

fn task_type(&self) -> String {
super::JOB_TYPE.to_string()
}
Expand Down
4 changes: 4 additions & 0 deletions src/deliver/deliver_chat_updates_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ impl Runnable for DeliverChatUpdatesJob {
true
}

fn max_retries(&self) -> i32 {
0
}

fn task_type(&self) -> String {
JOB_TYPE.to_string()
}
Expand Down
4 changes: 4 additions & 0 deletions src/deliver/deliver_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ impl Runnable for DeliverJob {
true
}

fn max_retries(&self) -> i32 {
0
}

fn task_type(&self) -> String {
super::JOB_TYPE.to_string()
}
Expand Down
4 changes: 4 additions & 0 deletions src/sync/sync_feed_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ impl Runnable for SyncFeedJob {
true
}

fn max_retries(&self) -> i32 {
0
}

fn task_type(&self) -> String {
super::JOB_TYPE.to_string()
}
Expand Down
4 changes: 4 additions & 0 deletions src/sync/sync_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ impl Runnable for SyncJob {
true
}

fn max_retries(&self) -> i32 {
0
}

fn task_type(&self) -> String {
super::JOB_TYPE.to_string()
}
Expand Down