forked from vhaudiquet/rhema-claw
fix(forge): a gitea comment names its thread without issue_url
`comment_event` read the thread number from `issue_url` alone and failed
the whole poll when it could not. The instance behind git.vhaudiquet.fr
sends `issue_url: ""` on every row of the repo-wide `/issues/comments`
feed, so the first comment row failed the pass with
malformed forge response: comment issue_url without a thread number:
and kept failing on every poll since the watch was created — 5296
consecutive failures, no event ever reported, no comment, no pull
request, nothing. The feed being broken was invisible: a watch that has
never polled once looks exactly like a quiet repository.
The number now comes from the first URL that carries one
(`issue_url`, then `pull_request_url`, then `html_url`), and a fragment is
dropped first: a comment's `html_url` points at the comment
(`…/pulls/1#issuecomment-164`), not at its thread. `is_pr` reads the same
three URLs, so a PR comment whose `issue_url` is blank still lands on the
pull request's sequence.
A row with no number anywhere is still a loud parse error — the
fallbacks must not degrade into a silently skipped event.
This commit is contained in:
1 parent
00037993af
commit
2f6c369e02
4 files changed
+237
-13
No files matched your search
@@ -177,12 +177,24 @@ impl Watcher {
|
||||
.cloned()
|
||||
}
|
||||
|
||||
/// One poll of `repo`: the page's events are ingested in feed order
|
||||
/// and the cursor advances to the page's. Returns how many events were
|
||||
/// fed to the dispatcher — replayed ids included, they dedup there.
|
||||
/// One poll of `repo` from the watcher's own cursor.
|
||||
pub async fn poll(&self, forge: &dyn Forge, repo: &RepoRef) -> Result<usize, WatchError> {
|
||||
let since = self.cursor(repo);
|
||||
let page = forge.poll(repo, since.as_ref()).await?;
|
||||
self.poll_since(forge, repo, since.as_ref()).await
|
||||
}
|
||||
|
||||
/// One poll of `repo` from an explicit `since`, for the embedder that
|
||||
/// keeps the cursor somewhere durable: the page's events are ingested
|
||||
/// in feed order and the watcher's cursor advances to the page's.
|
||||
/// Returns how many events were fed to the dispatcher — replayed ids
|
||||
/// included, they dedup there while they sit in an inbox.
|
||||
pub async fn poll_since(
|
||||
&self,
|
||||
forge: &dyn Forge,
|
||||
repo: &RepoRef,
|
||||
since: Option<&Timestamp>,
|
||||
) -> Result<usize, WatchError> {
|
||||
let page = forge.poll(repo, since).await?;
|
||||
let now = SystemClock.now_millis();
|
||||
let mut fed = 0;
|
||||
for event in &page.events {
|
||||
|
||||
Reference in new issue
Block a user