mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-03 04:10:49 +08:00
Protect from notifications that may be handled twice by keeping a set of handled notification IDs
This commit is contained in:
@ -1 +1,2 @@
|
||||
venv/
|
||||
venv/
|
||||
pr_agent/settings/.secrets.toml
|
@ -9,6 +9,7 @@ settings = Dynaconf(
|
||||
"settings/.secrets.toml",
|
||||
"settings/configuration.toml",
|
||||
"settings/pr_reviewer_prompts.toml",
|
||||
"settings/pr_questions_prompts.toml"
|
||||
"settings/pr_questions_prompts.toml",
|
||||
"settings_prod/.secrets.toml"
|
||||
]]
|
||||
)
|
||||
|
@ -20,6 +20,7 @@ def now() -> str:
|
||||
|
||||
|
||||
async def polling_loop():
|
||||
handled_ids = set()
|
||||
since = [now()]
|
||||
last_modified = [None]
|
||||
git_provider = get_git_provider()()
|
||||
@ -54,6 +55,9 @@ async def polling_loop():
|
||||
since[0] = None
|
||||
notifications = await response.json()
|
||||
for notification in notifications:
|
||||
if 'id' in notification and notification['id'] in handled_ids:
|
||||
continue
|
||||
handled_ids.add(notification['id'])
|
||||
if 'reason' in notification and notification['reason'] == 'mention':
|
||||
if 'subject' in notification and notification['subject']['type'] == 'PullRequest':
|
||||
pr_url = notification['subject']['url']
|
||||
|
Reference in New Issue
Block a user