Skip to content

Commit cc41c5a

Browse files
committed
Add github_updater to daemon
1 parent cf27c9e commit cc41c5a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/utils/daemon.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use libc::fork;
1313
use time;
1414
use DocBuilderOptions;
1515
use DocBuilder;
16-
use utils::{update_sources, update_release_activity};
16+
use utils::{update_sources, update_release_activity, github_updater};
1717
use db::{connect_db, update_search_index};
1818

1919

@@ -122,6 +122,17 @@ pub fn start_daemon() {
122122
}
123123
});
124124

125+
126+
// update github stats every 6 hours
127+
thread::spawn(move || {
128+
loop {
129+
thread::sleep(Duration::from_secs(60 * 60 * 6));
130+
if let Err(e) = github_updater() {
131+
error!("Failed to update github fields: {}", e);
132+
}
133+
}
134+
});
135+
125136
// TODO: update ssl certificate every 3 months
126137

127138
// at least start web server

src/utils/github_updater.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub fn github_updater() -> Result<(), DocBuilderError> {
5454
&crate_id])
5555
.map_err(DocBuilderError::DatabaseError)
5656
}) {
57-
error!("Failed to update github fields of: {} {}", crate_name, err);
57+
debug!("Failed to update github fields of: {} {}", crate_name, err);
5858
}
5959

6060
// sleep for rate limits

0 commit comments

Comments
 (0)