Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit 06a9a4b

Browse files
committed
Better handling of channel errors (#318)
1 parent 3fa1cf2 commit 06a9a4b

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

server/bleep/src/remotes/poll.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,19 @@ pub(crate) async fn sync_repositories(app: Application) {
4646
},
4747
result = handle.recv_async() => {
4848
let now = SystemTime::now();
49-
if result.is_ok() && now.duration_since(last_poll).unwrap() > POLL_PERIOD {
50-
debug!("github credentials changed; refreshing repositories");
51-
return now;
52-
}
53-
},
49+
match result {
50+
Ok(_) if now.duration_since(last_poll).unwrap() > POLL_PERIOD => {
51+
debug!("github credentials changed; refreshing repositories");
52+
return now;
53+
}
54+
Ok(_) => {
55+
continue;
56+
}
57+
Err(flume::RecvError::Disconnected) => {
58+
return SystemTime::now();
59+
}
60+
};
61+
}
5462
}
5563
}
5664
};

0 commit comments

Comments
 (0)