# HG changeset patch # User Thierry Florac # Date 1561027823 -7200 # Node ID 03c3572a16ad599e022202d7a233bb203e92ba8f # Parent 803130da71e5f649cf72431bd1ae38d353f9cd34 Imports cleanup diff -r 803130da71e5 -r 03c3572a16ad src/pyams_notify_ws/notify.py --- a/src/pyams_notify_ws/notify.py Sun Mar 11 11:23:33 2018 +0100 +++ b/src/pyams_notify_ws/notify.py Thu Jun 20 12:50:23 2019 +0200 @@ -12,25 +12,21 @@ __docformat__ = 'restructuredtext' - -# import standard library import asyncio import collections import json import pickle -# import interfaces -from pyams_cache.interfaces import IAioCacheHandler - -# import packages from aiopyramid.websocket.config.gunicorn import WebsocketMapper from aiopyramid.websocket.view import WebsocketConnectionView -from pyams_cache.cache import get_cache_handler -from pyams_notify_ws.subscribe import users, users_lock from pyramid.view import view_config +from pyams_cache.cache import get_cache_handler +from pyams_cache.interfaces import IAioCacheHandler +from pyams_notify_ws.subscribe import users, users_lock -queue = collections.deque(maxlen=50) + +queue = collections.deque(maxlen=100) queue_key = b'PyAMS:notify:messages_queue' queue_lock = asyncio.Lock() @@ -71,7 +67,7 @@ continue if subscription.filter_target(target): await connection.send(json_message) - # store message in memcached_queue + # store message in cached queue if cache_handler is not None: async with queue_lock: mem_queue = await cache_handler.get(queue_key)