mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-17 02:32:32 -05:00
add gevent.sleep(0) as a keep alive
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import gevent
|
||||||
from flask import Blueprint, current_app, jsonify, request
|
from flask import Blueprint, current_app, jsonify, request
|
||||||
|
|
||||||
from app import api_user, authenticated_service
|
from app import api_user, authenticated_service
|
||||||
@@ -87,7 +88,7 @@ def get_all_notifications():
|
|||||||
page = data.get("page", 1)
|
page = data.get("page", 1)
|
||||||
page_size = data.get("page_size", current_app.config.get("API_PAGE_SIZE"))
|
page_size = data.get("page_size", current_app.config.get("API_PAGE_SIZE"))
|
||||||
limit_days = data.get("limit_days")
|
limit_days = data.get("limit_days")
|
||||||
|
gevent.sleep(0) # keep this connection alive
|
||||||
pagination = notifications_dao.get_notifications_for_service(
|
pagination = notifications_dao.get_notifications_for_service(
|
||||||
str(authenticated_service.id),
|
str(authenticated_service.id),
|
||||||
personalisation=True,
|
personalisation=True,
|
||||||
@@ -98,6 +99,7 @@ def get_all_notifications():
|
|||||||
key_type=api_user.key_type,
|
key_type=api_user.key_type,
|
||||||
include_jobs=include_jobs,
|
include_jobs=include_jobs,
|
||||||
)
|
)
|
||||||
|
gevent.sleep(0) # keep this connection alive
|
||||||
|
|
||||||
serialized = []
|
serialized = []
|
||||||
for notification in pagination.items:
|
for notification in pagination.items:
|
||||||
@@ -137,6 +139,7 @@ def get_all_notifications():
|
|||||||
notification_data["subject"] = subject
|
notification_data["subject"] = subject
|
||||||
|
|
||||||
serialized.append(notification_data)
|
serialized.append(notification_data)
|
||||||
|
gevent.sleep(0) # keep this connection alive
|
||||||
|
|
||||||
result = jsonify(
|
result = jsonify(
|
||||||
notifications=serialized,
|
notifications=serialized,
|
||||||
|
|||||||
Reference in New Issue
Block a user