| 60 | 60 | | const MAX_ANCESTRY: u32 = 1000; |
| 61 | 61 | | /// The most tags a repository's Tags page reads and lists. |
| 62 | 62 | | const MAX_TAGS_READ: usize = 100; |
| 63 | | − | /// How long a last-commits walk may take before it answers with what it has. |
| 64 | | − | const LAST_COMMITS_BUDGET_MS: u64 = 2_500; |
| 65 | 63 | | |
| 66 | 64 | | /// One path segment, percent-encoded for a cache key. |
| 67 | 65 | | fn urlencoding_segment(segment: &str) -> String { |
| ⋯ |
| 772 | 770 | | return Ok(Outcome::Ok(found)); |
| 773 | 771 | | } |
| 774 | 772 | | } |
| 775 | | − | // A page waits on this: past the budget, what was found so far, not kept. |
| 773 | + | // Asked with a budget: past it, what was found so far, not kept. |
| 776 | 774 | | let started = worker::Date::now().as_millis(); |
| 777 | | − | let out_of_time = move || worker::Date::now().as_millis().saturating_sub(started) > LAST_COMMITS_BUDGET_MS; |
| 775 | + | let budget = a.budget_ms; |
| 776 | + | let out_of_time = move || budget.is_some_and(|budget| worker::Date::now().as_millis().saturating_sub(started) > budget); |
| 778 | 777 | | let (entries, complete) = last_commits::last_commits(&git, &head.hash, &a.tree_path, &out_of_time).await?; |
| 779 | 778 | | let stopped = out_of_time(); |
| 780 | 779 | | let found = g1t_contracts::repos::LastCommits { entries, complete }; |