Skip to content

Commit

Permalink
fix(ci): tweak logic
Browse files Browse the repository at this point in the history
  • Loading branch information
saying121 committed May 20, 2024
1 parent fa18d98 commit 348bfcd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,5 @@ jobs:

- name: Run Test
run: |
time cargo nextest run get_all_pbs_works new_get_index # generate database
cargo nextest run get_all_pbs_works new_get_index # generate database
cargo nextest run --all-features
12 changes: 12 additions & 0 deletions crates/leetcode-api/tests/sync_work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ fn trigger() -> bool {
let db_path = &*lcode_config::global::G_DATABASE_PATH;
if let Ok(f) = File::open(db_path) {
if let Ok(meta) = f.metadata() {
let Ok(ctime) = meta.created()
else {
return false;
};
let Ok(mtime) = meta.modified()
else {
return false;
};
// need init it
if ctime == mtime {
return true;
}
if let Ok(mod_time) = meta.modified() {
if let Ok(elapsed) = mod_time.elapsed() {
return elapsed > Duration::from_days(100);
Expand Down

0 comments on commit 348bfcd

Please sign in to comment.