@@ -23,10 +23,15 @@ pub fn github_updater() -> Result<(), DocBuilderError> {
23
23
24
24
// TODO: This query assumes repository field in Cargo.toml is
25
25
// always the same across all versions of a crate
26
- for row in & try!( conn. query ( "SELECT DISTINCT ON (crates.name) crate.name, crates.id, \
27
- repository_url FROM crates, releases WHERE releases.crate_id \
28
- = crates.id AND repository_url ~ '^https*://github.com' AND \
29
- github_last_update < NOW() + INTERVAL '1 day'",
26
+ for row in & try!( conn. query ( "SELECT DISTINCT ON (crates.name) \
27
+ crates.name, \
28
+ crates.id, \
29
+ releases.repository_url \
30
+ FROM crates \
31
+ INNER JOIN releases ON releases.crate_id = crates.id \
32
+ WHERE releases.repository_url ~ '^https*://github.com' AND \
33
+ (crates.github_last_update < NOW() - INTERVAL '1 day' OR \
34
+ crates.github_last_update IS NULL)",
30
35
& [ ] ) ) {
31
36
let crate_name: String = row. get ( 0 ) ;
32
37
let crate_id: i32 = row. get ( 1 ) ;
@@ -51,6 +56,11 @@ pub fn github_updater() -> Result<(), DocBuilderError> {
51
56
} ) {
52
57
error ! ( "Failed to update github fields of: {} {}" , crate_name, err) ;
53
58
}
59
+
60
+ // sleep for rate limits
61
+ use std:: thread;
62
+ use std:: time:: Duration ;
63
+ thread:: sleep ( Duration :: from_secs ( 2 ) ) ;
54
64
}
55
65
56
66
Ok ( ( ) )
0 commit comments