mirror of
https://github.com/Dasemu/Grove.git
synced 2026-11-27 07:46:13 +00:00
Merge pull request #12 from Dasemu/fix/purge-confirm-slow-passes
fix(daemon): keep purge confirmations across slow pass cycles
This commit is contained in:
3 files changed
+8
-3
No files matched your search
@@ -909,7 +909,7 @@ fn purge_if_gone(
|
|||||||
let first = {
|
let first = {
|
||||||
let mut map = gone_since.lock().unwrap();
|
let mut map = gone_since.lock().unwrap();
|
||||||
let entry = map.entry(repo.to_path_buf()).or_insert((now, now));
|
let entry = map.entry(repo.to_path_buf()).or_insert((now, now));
|
||||||
if now.saturating_sub(entry.1) > 2 * window {
|
if now.saturating_sub(entry.1) > purge::STALE_AFTER_SECS {
|
||||||
// Stale: start over.
|
// Stale: start over.
|
||||||
*entry = (now, now);
|
*entry = (now, now);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ use std::path::{Path, PathBuf};
|
|||||||
|
|
||||||
/// How long a remote deletion must keep being confirmed before the repo is moved.
|
/// How long a remote deletion must keep being confirmed before the repo is moved.
|
||||||
pub const CONFIRM_AFTER_SECS: u64 = 600;
|
pub const CONFIRM_AFTER_SECS: u64 = 600;
|
||||||
|
/// A confirmation older than this (no check in between, e.g. the forge was unreachable) no
|
||||||
|
/// longer counts and the wait starts over. Much longer than the time between two passes of
|
||||||
|
/// one repo, which can exceed 20 minutes with many repos.
|
||||||
|
pub const STALE_AFTER_SECS: u64 = 6 * 3600;
|
||||||
|
|
||||||
/// Fetch failures that may mean the remote repo is gone (only a hint; see [`confirmed_gone`]).
|
/// Fetch failures that may mean the remote repo is gone (only a hint; see [`confirmed_gone`]).
|
||||||
pub fn looks_gone(fetch_error: &str) -> bool {
|
pub fn looks_gone(fetch_error: &str) -> bool {
|
||||||
|
|||||||
+3
-2
@@ -129,8 +129,9 @@ purged_dir = "Purged" # default; "" disables the move
|
|||||||
|
|
||||||
- Trigger: a fetch fails with a "not found"-style error (also Gitea's SSH "Cannot find repository"). That is only a hint: the forge serving
|
- Trigger: a fetch fails with a "not found"-style error (also Gitea's SSH "Cannot find repository"). That is only a hint: the forge serving
|
||||||
`origin` must then answer 404 while the same token works (`test_connection`), and still do so
|
`origin` must then answer 404 while the same token works (`test_connection`), and still do so
|
||||||
`purge::CONFIRM_AFTER_SECS` (10 min) after the first confirmation (a gap of more than twice
|
`purge::CONFIRM_AFTER_SECS` (10 min) after the first confirmation (a gap of more than
|
||||||
that starts over). A working fetch, or the forge seeing the repo again, clears it. Network or
|
`STALE_AFTER_SECS`, 6 h, between two confirmations starts over: a pass over many repos can take
|
||||||
|
longer than 20 min, so a shorter gap never let a deletion be confirmed). A working fetch, or the forge seeing the repo again, clears it. Network or
|
||||||
token errors change nothing.
|
token errors change nothing.
|
||||||
- Only repos owned by the token's account, or by an organisation named in some group's `owners`
|
- Only repos owned by the token's account, or by an organisation named in some group's `owners`
|
||||||
for that provider, are ever moved: someone else's repo turning private or revoking access looks
|
for that provider, are ever moved: someone else's repo turning private or revoking access looks
|
||||||
|
|||||||
Reference in new issue
Block a user