From 3e9ca87fa7ba56e207f530d4c19b547abd313b60 Mon Sep 17 00:00:00 2001 From: Nicholas Tindle Date: Fri, 7 Feb 2025 20:52:17 -0600 Subject: [PATCH] fix(backend): upstream changes --- autogpt_platform/backend/backend/data/model.py | 1 - autogpt_platform/backend/backend/executor/manager.py | 6 +----- .../backend/backend/notifications/models.py | 1 - .../backend/backend/notifications/notifications.py | 12 ++++++------ 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/autogpt_platform/backend/backend/data/model.py b/autogpt_platform/backend/backend/data/model.py index f859713df4..0c1d2334a3 100644 --- a/autogpt_platform/backend/backend/data/model.py +++ b/autogpt_platform/backend/backend/data/model.py @@ -36,7 +36,6 @@ from pydantic_core import ( ) from backend.integrations.providers import ProviderName -from backend.notifications.models import NotificationType from backend.util.settings import Secrets if TYPE_CHECKING: diff --git a/autogpt_platform/backend/backend/executor/manager.py b/autogpt_platform/backend/backend/executor/manager.py index 4b528e9963..7476c0e16f 100644 --- a/autogpt_platform/backend/backend/executor/manager.py +++ b/autogpt_platform/backend/backend/executor/manager.py @@ -12,11 +12,7 @@ from typing import TYPE_CHECKING, Any, Generator, Optional, TypeVar, cast from redis.lock import Lock as RedisLock -from backend.notifications.models import ( - AgentRunData, - NotificationType, - create_notification, -) +from backend.notifications.models import AgentRunData, create_notification if TYPE_CHECKING: from backend.executor import DatabaseManager diff --git a/autogpt_platform/backend/backend/notifications/models.py b/autogpt_platform/backend/backend/notifications/models.py index 2debcd15bd..a3aa376e4a 100644 --- a/autogpt_platform/backend/backend/notifications/models.py +++ b/autogpt_platform/backend/backend/notifications/models.py @@ -5,7 +5,6 @@ from pydantic import BaseModel, Field from backend.data.model import BatchingStrategy, NotificationType - T_co = TypeVar("T_co", bound="BaseNotificationData", covariant=True) diff --git a/autogpt_platform/backend/backend/notifications/notifications.py b/autogpt_platform/backend/backend/notifications/notifications.py index 92ae4a6367..618eb32f8f 100644 --- a/autogpt_platform/backend/backend/notifications/notifications.py +++ b/autogpt_platform/backend/backend/notifications/notifications.py @@ -216,17 +216,17 @@ class NotificationManager(AppService): # users = [db.get_user(user_id)] users = [] else: - users = db.get_active_users_in_timerange( + users = db.get_active_user_ids_in_timerange( start_time.isoformat(), end_time.isoformat() ) - for user in users: + for user_id in users: await self.summary_manager.generate_summary( - summary_type, user.id, start_time, end_time, self + summary_type, user_id, start_time, end_time, self ) # Schedule next summary if this wasn't manually triggered if not user_id and not summary_type: - await self._schedule_next_summary(summary_type, user.id) + await self._schedule_next_summary(summary_type, user_id) async def _process_summary_trigger(self, message: str): """Process a summary trigger message""" @@ -300,9 +300,9 @@ class NotificationManager(AppService): summary_queues.append(queue) # Initial summary scheduling - for user in get_db_client().get_active_users(): + for user_id in get_db_client().get_active_users_ids(): for summary_type in ["daily", "weekly", "monthly"]: - self.run_and_wait(self._schedule_next_summary(summary_type, user.id)) + self.run_and_wait(self._schedule_next_summary(summary_type, user_id)) while self.running: try: