Skip to content

Commit

Permalink
Merge pull request #51 from tartiflette/mra/misc
Browse files Browse the repository at this point in the history
Fixes & tartiflette >=1.0.0,<2.0.0 compatibility
  • Loading branch information
Maximilien-R authored Sep 12, 2019
2 parents 85d349d + af06ec0 commit 7c47d50
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 44 deletions.
64 changes: 34 additions & 30 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,37 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Released]

- [0.8.x]
- [0.8.5](./changelogs/0.8.5.md) - 2019-09-04
- [0.8.4](./changelogs/0.8.4.md) - 2019-08-13
- [0.8.3](./changelogs/0.8.3.md) - 2019-08-13
- [0.8.2](./changelogs/0.8.2.md) - 2019-07-03
- [0.8.1](./changelogs/0.8.1.md) - 2019-06-19
- [0.8.0](./changelogs/0.8.0.md) - 2019-06-17
- [0.7.x]
- [0.7.0](./changelogs/0.7.0.md) - 2019-05-21
- [0.6.x]
- [0.6.3](./changelogs/0.6.3.md) - 2019-05-09
- [0.6.2](./changelogs/0.6.2.md) - 2019-04-11
- [0.6.0](./changelogs/0.6.0.md) - 2019-04-02
- [0.5.x]
- [0.5.1](./changelogs/0.5.1.md) - 2019-03-29
- [0.5.0](./changelogs/0.5.0.md) - 2019-03-25
- [0.4.x]
- [0.4.2](./changelogs/0.4.2.md) - 2019-03-06
- [0.4.1](./changelogs/0.4.1.md) - 2019-03-05
- [0.4.0](./changelogs/0.4.0.md) - 2019-03-04
- [0.3.x]
- [0.3.1](./changelogs/0.3.1.md) - 2019-02-28
- [0.3.0](./changelogs/0.3.0.md) - 2019-02-25
- [0.2.x]
- [0.2.1](./changelogs/0.2.1.md) - 2019-02-21
- [0.2.0](./changelogs/0.2.0.md) - 2019-01-14
- [0.1.x]
- [0.1.2](./changelogs/0.1.2.md) - 2018-12-07
- [0.1.1](./changelogs/0.1.1.md) - 2018-12-06
- [0.1.0](./changelogs/0.1.0.md) - 2018-12-05
- [1.x.x]
- [1.0.x]
- [1.0.0](./changelogs/1.0.0.md) - 2019-09-12
- [0.x.x]
- [0.8.x]
- [0.8.5](./changelogs/0.8.5.md) - 2019-09-04
- [0.8.4](./changelogs/0.8.4.md) - 2019-08-13
- [0.8.3](./changelogs/0.8.3.md) - 2019-08-13
- [0.8.2](./changelogs/0.8.2.md) - 2019-07-03
- [0.8.1](./changelogs/0.8.1.md) - 2019-06-19
- [0.8.0](./changelogs/0.8.0.md) - 2019-06-17
- [0.7.x]
- [0.7.0](./changelogs/0.7.0.md) - 2019-05-21
- [0.6.x]
- [0.6.3](./changelogs/0.6.3.md) - 2019-05-09
- [0.6.2](./changelogs/0.6.2.md) - 2019-04-11
- [0.6.0](./changelogs/0.6.0.md) - 2019-04-02
- [0.5.x]
- [0.5.1](./changelogs/0.5.1.md) - 2019-03-29
- [0.5.0](./changelogs/0.5.0.md) - 2019-03-25
- [0.4.x]
- [0.4.2](./changelogs/0.4.2.md) - 2019-03-06
- [0.4.1](./changelogs/0.4.1.md) - 2019-03-05
- [0.4.0](./changelogs/0.4.0.md) - 2019-03-04
- [0.3.x]
- [0.3.1](./changelogs/0.3.1.md) - 2019-02-28
- [0.3.0](./changelogs/0.3.0.md) - 2019-02-25
- [0.2.x]
- [0.2.1](./changelogs/0.2.1.md) - 2019-02-21
- [0.2.0](./changelogs/0.2.0.md) - 2019-01-14
- [0.1.x]
- [0.1.2](./changelogs/0.1.2.md) - 2018-12-07
- [0.1.1](./changelogs/0.1.1.md) - 2018-12-06
- [0.1.0](./changelogs/0.1.0.md) - 2018-12-05
14 changes: 14 additions & 0 deletions changelogs/1.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# [1.0.0] -- 2019-09-12

## Changed

- Bump `subscriptions-transport-ws` from `0.7.0` to `0.8.3`
- Bump `graphiql` from `0.12.0` to `0.14.2`
- Update `aiohttp` requirement from `>=3.5.4,<3.6.0` to `>=3.5.4,<3.7.0`
- Bump `pytest` from `5.1.1` to `5.1.2`
- Update `tartiflette` requirement from `>=0.12.0,<0.13.0` to `>=0.12.0,<2.0.0` - [ISSUE-49](https://github.com/tartiflette/tartiflette-aiohttp/issues/49) thrown by @aljinovic

## Fixed

- Fix `RuntimeError` when subscription connection is reset - [ISSUE-50](https://github.com/tartiflette/tartiflette-aiohttp/issues/50) thrown by @jonypawks
- Determines the appropriate `ws` protocol to use depending on current used protocol - [ISSUE-20](https://github.com/tartiflette/tartiflette-aiohttp/issues/20) thrown by @bkcsfi
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import find_packages, setup

_TEST_REQUIRE = [
"pytest==5.1.1",
"pytest==5.1.2",
"pytest-cov==2.7.1",
"pytest-asyncio==0.10.0",
"pytest-aiohttp==0.3.0",
Expand All @@ -13,7 +13,7 @@
"isort==4.3.21",
]

_VERSION = "0.8.5"
_VERSION = "1.0.0"

_PACKAGES = find_packages(exclude=["tests*"])

Expand All @@ -35,7 +35,7 @@
],
keywords="api graphql protocol api rest relay tartiflette dailymotion",
packages=_PACKAGES,
install_requires=["aiohttp<3.6.0,>=3.5.4", "tartiflette<0.13.0,>=0.12.0"],
install_requires=["aiohttp>=3.5.4,<3.7.0", "tartiflette>=0.12.0,<2.0.0"],
tests_require=_TEST_REQUIRE,
extras_require={"test": _TEST_REQUIRE},
include_package_data=True,
Expand Down
9 changes: 5 additions & 4 deletions tartiflette_aiohttp/_graphiql.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
<meta charset="utf-8" />
<title>GraphiQL</title>
<meta name="robots" content="noindex" />
<link href="//cdn.jsdelivr.net/npm/graphiql@0.12.0/graphiql.css" rel="stylesheet">
<link href="//cdn.jsdelivr.net/npm/graphiql@0.14.2/graphiql.css" rel="stylesheet">
<script src="//cdn.jsdelivr.net/es6-promise/4.0.5/es6-promise.auto.min.js"></script>
<script src="//cdn.jsdelivr.net/fetch/0.9.0/fetch.min.js"></script>
<script src="//cdn.jsdelivr.net/react/15.4.2/react.min.js"></script>
<script src="//cdn.jsdelivr.net/react/15.4.2/react-dom.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/graphiql@0.12.0/graphiql.js"></script>
<script src="//cdn.jsdelivr.net/npm/subscriptions-transport-ws@0.7.0/browser/client.js"></script>
<script src="//cdn.jsdelivr.net/npm/graphiql@0.14.2/graphiql.js"></script>
<script src="//cdn.jsdelivr.net/npm/subscriptions-transport-ws@0.8.3/browser/client.js"></script>
<script src="//cdn.jsdelivr.net/npm/[email protected]/browser/client.js"></script>
</head>
<body>
Expand Down Expand Up @@ -151,7 +151,8 @@
if (window.location.port !== "") {
subscriptionURL += ":" + window.location.port;
}
return "ws://" + subscriptionURL + endpoint;
var protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
return protocol + "//" + subscriptionURL + endpoint;
}

// Wrap GraphQLFetcher with subscription fetcher if needed.
Expand Down
13 changes: 6 additions & 7 deletions tartiflette_aiohttp/_subscription_ws_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def register_operation(
self._operations[operation_id] = async_iterator

def get_operation(self, operation_id: str) -> AsyncIterator:
return self._operations[operation_id]
return self._operations.get(operation_id)

def remove_operation(self, operation_id: str) -> None:
del self._operations[operation_id]
self._operations.pop(operation_id, None)

async def receive(self) -> str:
msg = await self._socket.receive()
Expand Down Expand Up @@ -134,11 +134,10 @@ async def _on_connection_terminate(
async def _unsubscribe(
self, connection_context: "AIOHTTPConnectionContext", operation_id: str
) -> None:
try:
await connection_context.get_operation(operation_id).aclose()
operation = connection_context.get_operation(operation_id)
if operation is not None:
await operation.aclose()
connection_context.remove_operation(operation_id)
except KeyError:
pass

async def _on_start(
self,
Expand Down Expand Up @@ -228,7 +227,7 @@ async def _on_close(
connection_context: "AIOHTTPConnectionContext",
tasks: Set["Task"],
) -> None:
for operation_id in connection_context.operations:
for operation_id in list(connection_context.operations):
await self._unsubscribe(connection_context, operation_id)

for task in tasks:
Expand Down

0 comments on commit 7c47d50

Please sign in to comment.