mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-03 12:20:38 +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/.secrets.toml",
|
||||||
"settings/configuration.toml",
|
"settings/configuration.toml",
|
||||||
"settings/pr_reviewer_prompts.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():
|
async def polling_loop():
|
||||||
|
handled_ids = set()
|
||||||
since = [now()]
|
since = [now()]
|
||||||
last_modified = [None]
|
last_modified = [None]
|
||||||
git_provider = get_git_provider()()
|
git_provider = get_git_provider()()
|
||||||
@ -54,6 +55,9 @@ async def polling_loop():
|
|||||||
since[0] = None
|
since[0] = None
|
||||||
notifications = await response.json()
|
notifications = await response.json()
|
||||||
for notification in notifications:
|
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 'reason' in notification and notification['reason'] == 'mention':
|
||||||
if 'subject' in notification and notification['subject']['type'] == 'PullRequest':
|
if 'subject' in notification and notification['subject']['type'] == 'PullRequest':
|
||||||
pr_url = notification['subject']['url']
|
pr_url = notification['subject']['url']
|
||||||
|
Reference in New Issue
Block a user