From c4e0a8e1db16dee8857568db396f26cf84229fc8 Mon Sep 17 00:00:00 2001 From: vrde Date: Thu, 19 Oct 2017 12:19:43 +0200 Subject: [PATCH 1/5] Handle WS CLOSE properly --- bigchaindb/web/websocket_server.py | 34 ++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/bigchaindb/web/websocket_server.py b/bigchaindb/web/websocket_server.py index bcf14f35..effc153c 100644 --- a/bigchaindb/web/websocket_server.py +++ b/bigchaindb/web/websocket_server.py @@ -70,6 +70,15 @@ class Dispatcher: self.subscribers[uuid] = websocket + def unsubscribe(self, uuid): + """Remove a websocket from the list of subscribers. + + Args: + uuid (str): a unique identifier for the websocket. + """ + + del self.subscribers[uuid] + @asyncio.coroutine def publish(self): """Publish new events to the subscribers.""" @@ -115,11 +124,16 @@ def websocket_handler(request): msg = yield from websocket.receive() except RuntimeError as e: logger.debug('Websocket exception: %s', str(e)) - return websocket - - if msg.type == aiohttp.WSMsgType.ERROR: + break + if msg.type == aiohttp.WSMsgType.CLOSED: + logger.debug('Websocket closed') + break + elif msg.type == aiohttp.WSMsgType.ERROR: logger.debug('Websocket exception: %s', websocket.exception()) - return websocket + break + + request.app['dispatcher'].unsubscribe(uuid) + return websocket def init_app(event_source, *, loop=None): @@ -157,3 +171,15 @@ def start(sync_event_source, loop=None): aiohttp.web.run_app(app, host=config['wsserver']['host'], port=config['wsserver']['port']) + + +if __name__ == '__main__': + def meow(queue): + while True: + yield from asyncio.sleep(1) + yield from queue.put('meow') + loop = asyncio.get_event_loop() + event_source = asyncio.Queue(loop=loop) + # loop.create_task(meow(event_source)) + app = init_app(event_source, loop=loop) + aiohttp.web.run_app(app) From e242345327f7094002f38179a3b04449883e8fe8 Mon Sep 17 00:00:00 2001 From: vrde Date: Thu, 9 Nov 2017 15:59:02 +0100 Subject: [PATCH 2/5] Remove sample code --- bigchaindb/web/websocket_server.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/bigchaindb/web/websocket_server.py b/bigchaindb/web/websocket_server.py index effc153c..930ebc94 100644 --- a/bigchaindb/web/websocket_server.py +++ b/bigchaindb/web/websocket_server.py @@ -171,15 +171,3 @@ def start(sync_event_source, loop=None): aiohttp.web.run_app(app, host=config['wsserver']['host'], port=config['wsserver']['port']) - - -if __name__ == '__main__': - def meow(queue): - while True: - yield from asyncio.sleep(1) - yield from queue.put('meow') - loop = asyncio.get_event_loop() - event_source = asyncio.Queue(loop=loop) - # loop.create_task(meow(event_source)) - app = init_app(event_source, loop=loop) - aiohttp.web.run_app(app) From cfa63ae9af7b826ecf7da72eee953f2e1a833c5b Mon Sep 17 00:00:00 2001 From: Troy McConaghy Date: Mon, 13 Nov 2017 13:38:00 +0100 Subject: [PATCH 3/5] Updated the changelog for the v1.2 release --- CHANGELOG.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7622b2c2..feef1748 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,26 @@ For reference, the possible headings are: * **External Contributors** to list contributors outside of BigchainDB GmbH. * **Notes** +## [1.2] - 2017-11-13 +Tag name: v1.2.0 + +### Added +* New and improved installation setup docs and code. Pull requests [#1775](https://github.com/bigchaindb/bigchaindb/pull/1775) and [#1785](https://github.com/bigchaindb/bigchaindb/pull/1785) +* New BigchainDB configuration setting to set the port number of the log server: `log.port`. [Pull request #1796](https://github.com/bigchaindb/bigchaindb/pull/1796) +* New secondary index on `id` in the bigchain table. That will make some queries execute faster. [Pull request #1803](https://github.com/bigchaindb/bigchaindb/pull/1803) +* When using MongoDB, there are some restrictions on allowed names for keys (JSON keys). Those restrictions were always there but now BigchainDB checks key names explicitly, rather than leaving that to MongoDB. Pull requests [#1807](https://github.com/bigchaindb/bigchaindb/pull/1807) and [#1811](https://github.com/bigchaindb/bigchaindb/pull/1811) +* When using MongoDB, there are some restrictions on the allowed values of "language" (if that key is used in the values of `metadata` or `asset.data`). Those restrictions were always there but now BigchainDB checks the values explicitly, rather than leaving that to MongoDB. Pull requests [#1806](https://github.com/bigchaindb/bigchaindb/pull/1806) and [#1811](https://github.com/bigchaindb/bigchaindb/pull/1811) +* There's a new page in the root docs about permissions in BigchainDB. [Pull request #1788](https://github.com/bigchaindb/bigchaindb/pull/1788) +* There's a new option in the `bigchaindb start` command: `bigchaindb start --no-init` will avoid doing `bigchaindb init` if it wasn't done already. [Pull request #1814](https://github.com/bigchaindb/bigchaindb/pull/1814) + +### Fixed +* Fixed a bug where setting the log level in a BigchainDB config file didn't have any effect. It does now. [Pull request #1797](https://github.com/bigchaindb/bigchaindb/pull/1797) +* The docs were wrong about there being no Ping/Pong support in the Events API. There is, so the docs were fixed. [Pull request #1799](https://github.com/bigchaindb/bigchaindb/pull/1799) +* Fixed an issue with closing WebSocket connections properly. [Pull request #1819](https://github.com/bigchaindb/bigchaindb/pull/1819) + +### Notes +* Many changes were made to the Kubernetes-based production deployment template and code. + ## [1.1] - 2017-09-26 Tag name: v1.1.0 From 67c8c6a1cbccebba09912c98cd9f1ab12b71147d Mon Sep 17 00:00:00 2001 From: Troy McConaghy Date: Mon, 13 Nov 2017 13:54:13 +0100 Subject: [PATCH 4/5] Updated Docker image version to 1.2.0 in k8s YAML files --- k8s/bigchaindb/bigchaindb-dep.yaml | 2 +- k8s/dev-setup/bigchaindb.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/k8s/bigchaindb/bigchaindb-dep.yaml b/k8s/bigchaindb/bigchaindb-dep.yaml index 6c4ca88c..5e23f4c0 100644 --- a/k8s/bigchaindb/bigchaindb-dep.yaml +++ b/k8s/bigchaindb/bigchaindb-dep.yaml @@ -12,7 +12,7 @@ spec: terminationGracePeriodSeconds: 10 containers: - name: bigchaindb - image: bigchaindb/bigchaindb:1.1.0 + image: bigchaindb/bigchaindb:1.2.0 imagePullPolicy: IfNotPresent args: - start diff --git a/k8s/dev-setup/bigchaindb.yaml b/k8s/dev-setup/bigchaindb.yaml index e6c39775..e9980a96 100644 --- a/k8s/dev-setup/bigchaindb.yaml +++ b/k8s/dev-setup/bigchaindb.yaml @@ -34,7 +34,7 @@ spec: terminationGracePeriodSeconds: 10 containers: - name: bigchaindb - image: bigchaindb/bigchaindb:1.1.0 + image: bigchaindb/bigchaindb:1.2.0 imagePullPolicy: Always args: - start From 9bed27b98f3c7c4f0c147756d6df3b66242c458a Mon Sep 17 00:00:00 2001 From: Troy McConaghy Date: Mon, 13 Nov 2017 14:53:25 +0100 Subject: [PATCH 5/5] Updated to 1.3.0.dev in version.py --- bigchaindb/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bigchaindb/version.py b/bigchaindb/version.py index 7c0b19ea..4937b037 100644 --- a/bigchaindb/version.py +++ b/bigchaindb/version.py @@ -1,2 +1,2 @@ -__version__ = '1.2.0.dev' -__short_version__ = '1.2.dev' +__version__ = '1.3.0.dev' +__short_version__ = '1.3.dev'