mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Problem: abruptly closed sockets still in memory (#2408)
Solution: Catch the proper exception and remove socket from memory.
This commit is contained in:
parent
0c33b4c211
commit
2087f7090f
@ -16,6 +16,7 @@ import asyncio
|
|||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
from concurrent.futures import CancelledError
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
@ -125,6 +126,9 @@ def websocket_handler(request):
|
|||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
logger.debug('Websocket exception: %s', str(e))
|
logger.debug('Websocket exception: %s', str(e))
|
||||||
break
|
break
|
||||||
|
except CancelledError as e:
|
||||||
|
logger.debug('Websocket closed')
|
||||||
|
break
|
||||||
if msg.type == aiohttp.WSMsgType.CLOSED:
|
if msg.type == aiohttp.WSMsgType.CLOSED:
|
||||||
logger.debug('Websocket closed')
|
logger.debug('Websocket closed')
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user