mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-11 18:35:18 +00:00
feat: enhance GitHub polling with synchronous comment processing and improved logging
This commit is contained in:
parent
b8d2b263b9
commit
19048ee705
1 changed files with 9 additions and 13 deletions
|
|
@ -16,6 +16,15 @@ setup_logger(fmt=LoggingFormat.JSON, level="DEBUG")
|
|||
NOTIFICATION_URL = "https://api.github.com/notifications"
|
||||
|
||||
|
||||
async def mark_notification_as_read(headers, notification, session):
|
||||
async with session.patch(
|
||||
f"https://api.github.com/notifications/threads/{notification['id']}",
|
||||
headers=headers) as mark_read_response:
|
||||
if mark_read_response.status != 205:
|
||||
get_logger().error(
|
||||
f"Failed to mark notification as read. Status code: {mark_read_response.status}")
|
||||
|
||||
|
||||
def now() -> str:
|
||||
"""
|
||||
Get the current UTC time in ISO 8601 format.
|
||||
|
|
@ -218,18 +227,5 @@ async def polling_loop():
|
|||
artifact={"traceback": traceback.format_exc()})
|
||||
|
||||
|
||||
async def mark_notification_as_read(headers, notification, session):
|
||||
async with session.patch(
|
||||
f"https://api.github.com/notifications/threads/{notification['id']}",
|
||||
headers=headers) as mark_read_response:
|
||||
if mark_read_response.status != 205:
|
||||
get_logger().error(
|
||||
f"Failed to mark notification as read. Status code: {mark_read_response.status}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(polling_loop())
|
||||
|
||||
# # Example usage
|
||||
# task_queue = deque([lambda: print("Task executed1"), lambda: print("Task executed2")])
|
||||
# asyncio.run(background_task_manager(task_queue))
|
||||
Loading…
Reference in a new issue