Factory: exact parallel limit, remove issues from the board
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aa6ee7fd31
commit
486c49d50b
8 files changed
+76
-1
No files matched your search
@@ -562,6 +562,14 @@ impl Forge {
|
||||
Ok(!matches!(v["state"].as_str(), Some("closed")))
|
||||
}
|
||||
|
||||
/// Has the issue been deleted on the forge (404)? Other errors (network, token) count as "still there".
|
||||
pub async fn issue_gone(&self, number: u64) -> bool {
|
||||
match self.call(reqwest::Method::GET, self.rp(&format!("/issues/{number}")), None).await {
|
||||
Err(e) => e.to_string().contains("404"),
|
||||
Ok(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn close_issue(&self, number: u64) -> Result<()> {
|
||||
match self.kind {
|
||||
Kind::Gitlab => self.call(reqwest::Method::PUT, self.rp(&format!("/issues/{number}")), Some(json!({"state_event": "close"}))).await.map(|_| ()),
|
||||
@@ -1353,6 +1361,14 @@ pub async fn poll_repo(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<()>
|
||||
app.store.factory_issue_set(&cfg.url, n, &[("state", json!("closed"))])?;
|
||||
}
|
||||
}
|
||||
// Issues deleted on the forge leave the board (closed ones stay: they still exist there).
|
||||
for row in app.store.factory_issues(&user.id)?.into_iter().filter(|r| r["repo"].as_str() == Some(cfg.url.as_str()) && !matches!(r["state"].as_str(), Some("review" | "building" | "testing"))) {
|
||||
let n = issue_no(&row);
|
||||
if n > 0 && !open.contains(&n) && g.issue_gone(n as u64).await {
|
||||
tracing::info!("factory {}: #{n} was deleted on the forge – removed from the board", cfg.url);
|
||||
app.store.factory_issue_delete(&cfg.url, n)?;
|
||||
}
|
||||
}
|
||||
// Merged issues get their version and tag.
|
||||
if let Err(e) = crate::factory_version::version_pass(app, user, cfg).await {
|
||||
tracing::warn!("factory {}: versions: {e:#}", cfg.url);
|
||||
|
||||
Reference in new issue
Block a user