Skip to content

Commit eba34e8

Browse files
committed
DBC22-4825: nearby objs task runs once every hour instead
1 parent 1bfce25 commit eba34e8

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/backend/apps/event/tasks.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from apps.shared.enums import CacheKey
2020
from apps.shared.helpers import attach_default_email_images, attach_image_to_email
2121
from apps.shared.models import Area
22-
from apps.webcam.tasks import update_camera_nearby_objs
2322
from django.conf import settings
2423
from django.contrib.gis.geos import LineString, Point
2524
from django.core.cache import cache
@@ -219,9 +218,6 @@ def populate_all_event_data():
219218
# Send notifications
220219
send_event_notifications(updated_event_ids)
221220

222-
# Update nearby count for all cameras
223-
update_camera_nearby_objs()
224-
225221

226222
def get_image_type_file_name(event):
227223
major_delay_icon_map = {

src/backend/apps/feed/tasks.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
build_route_geometries,
1616
populate_all_webcam_data,
1717
update_all_webcam_data,
18+
update_camera_nearby_objs,
1819
)
1920
from apps.wildfire.tasks import populate_all_wildfire_data
2021
from django.core.cache import cache
@@ -35,6 +36,12 @@ def update_camera_task():
3536
update_all_webcam_data()
3637

3738

39+
@db_periodic_task(crontab(hour="*/1", minute="0"))
40+
@lock_task('update-camera-nearby-lock')
41+
def update_camera_nearby_objs_task():
42+
update_camera_nearby_objs()
43+
44+
3845
@db_periodic_task(crontab(minute="*/1"))
3946
@lock_task('events-lock')
4047
def populate_event_task():

0 commit comments

Comments
 (0)