Skip to content

Commit dd3aca1

Browse files
authored
Merge pull request #110 from saltyrtc/yet-another-task-queue-refactoring
Refactor tasks and jobs and give them hard constraints A task: - Must never return - Must always exit with an exception A job may return or exit with an exception The job queue runner: - Does not exit before the job queue is closed or cancelled - Must not return before the connection has been closed
2 parents 442f5b2 + 00c6771 commit dd3aca1

14 files changed

+1086
-668
lines changed

.circleci/config.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,6 @@ jobs:
7676
- EVENT_LOOP: uvloop
7777
- TIMEOUT: "2.0"
7878

79-
test-pypy-3_6-asyncio:
80-
<<: *shared
81-
docker:
82-
- image: saltyrtc/circleci-image-python:pypy-3.6
83-
environment:
84-
- EVENT_LOOP: asyncio
85-
- TIMEOUT: "6.0"
86-
87-
test-pypy-3_5-asyncio:
88-
<<: *shared
89-
docker:
90-
- image: saltyrtc/circleci-image-python:pypy-3.5
91-
environment:
92-
- EVENT_LOOP: asyncio
93-
- TIMEOUT: "6.0"
94-
9579
lint:
9680
docker:
9781
- image: saltyrtc/circleci-image-python:python-3.7
@@ -178,8 +162,6 @@ workflows:
178162
- test-python-3_6-uvloop
179163
- test-python-3_5-asyncio
180164
- test-python-3_5-uvloop
181-
- test-pypy-3_6-asyncio
182-
- test-pypy-3_5-asyncio
183165
docker:
184166
jobs:
185167
- build-docker:

saltyrtc/server/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from .message import * # noqa
1111
from .protocol import * # noqa
1212
from .server import * # noqa
13+
from .task import * # noqa
1314
from .util import * # noqa
1415

1516
__all__ = tuple(itertools.chain(
@@ -20,6 +21,7 @@
2021
message.__all__, # noqa
2122
protocol.__all__, # noqa
2223
server.__all__, # noqa
24+
task.__all__, # noqa
2325
util.__all__, # noqa
2426
))
2527

saltyrtc/server/bin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import os
77
import signal
88
import stat
9-
from typing import Any # noqa
109
from typing import Coroutine # noqa
1110
from typing import List # noqa
1211
from typing import Optional # noqa
1312
from typing import Sequence # noqa
13+
from typing import Any
1414

1515
import click
1616
import libnacl.public

saltyrtc/server/common.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
'KEEP_ALIVE_INTERVAL_DEFAULT',
3333
'KEEP_ALIVE_TIMEOUT',
3434
'OverflowSentinel',
35-
'TaskLoopStopSentinel',
3635
'SubProtocol',
3736
'CloseCode',
3837
'DropReason',
@@ -77,13 +76,6 @@ class OverflowSentinel:
7776
"""
7877

7978

80-
class TaskLoopStopSentinel:
81-
"""
82-
The task loop will stop if this has been dequeued from the task
83-
queue.
84-
"""
85-
86-
8779
@enum.unique
8880
class SubProtocol(enum.Enum):
8981
saltyrtc_v1 = 'v1.saltyrtc.org'

saltyrtc/server/exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class DowngradeError(SignalingError):
8686
class Disconnected(Exception):
8787
"""
8888
The client disconnected from the server or has been disconnected by
89-
the server.
89+
the server (e.g. by a drop request).
9090
9191
..note:: This does not derive from :class:`SignalingError` since it
9292
is not considered an *error*.

0 commit comments

Comments
 (0)