Skip to content

Commit

Permalink
Merge pull request #480 from opengisch/timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
suricactus authored Feb 3, 2023
2 parents b3df0c6 + 494ab2a commit 73c3234
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
# Run unit tests
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
qgis_version: [release-3_16, latest]
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
xvfb-run pytest
release:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
OSGEO_USERNAME: mkuhn
OSGEO_PASSWORD: ${{ secrets.OSGEO_PASSWORD }}
Expand All @@ -87,7 +87,7 @@ jobs:
submodules: recursive
- name: Install dependencies
run: |
sudo apt update && sudo apt install qttools5-dev-tools qt5-default
sudo apt update && sudo apt install qtbase5-dev qttools5-dev-tools
sudo pip install qgis-plugin-ci
- name: Release
run: |
Expand All @@ -101,7 +101,7 @@ jobs:
--osgeo-password ${OSGEO_PASSWORD}
package:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TX_TOKEN: ${{ secrets.TX_TOKEN }}
Expand All @@ -115,7 +115,7 @@ jobs:
ref: ${{ github.event.inputs.ref }}
- name: Install dependencies
run: |
sudo apt update && sudo apt install qttools5-dev-tools qt5-default
sudo apt update && sudo apt install qtbase5-dev qttools5-dev-tools
sudo pip install qgis-plugin-ci
- name: Release
run: |
Expand All @@ -127,7 +127,7 @@ jobs:
path: ./qfieldsync.${{ github.event.inputs.ref }}.zip

translations:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}
Expand Down
26 changes: 20 additions & 6 deletions qfieldsync/core/cloud_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,9 @@ def cloud_get(
b"Authorization", "Token {}".format(self._token).encode("utf-8")
)

reply = self._nam.get(request)
with disable_nam_timeout(self._nam):
reply = self._nam.get(request)

reply.sslErrors.connect(lambda sslErrors: reply.ignoreSslErrors(sslErrors))
reply.setParent(self)

Expand All @@ -421,7 +423,9 @@ def get(self, url: QUrl, local_filename: str = None) -> QNetworkReply:
QNetworkRequest.UserVerifiedRedirectPolicy,
)

reply = self._nam.get(request)
with disable_nam_timeout(self._nam):
reply = self._nam.get(request)

reply.sslErrors.connect(lambda sslErrors: reply.ignoreSslErrors(sslErrors))
reply.setParent(self)

Expand Down Expand Up @@ -464,7 +468,10 @@ def cloud_post(
)

payload_bytes = b"" if payload is None else json.dumps(payload).encode("utf-8")
reply = self._nam.post(request, payload_bytes)

with disable_nam_timeout(self._nam):
reply = self._nam.post(request, payload_bytes)

reply.sslErrors.connect(lambda sslErrors: reply.ignoreSslErrors(sslErrors))
reply.setParent(self)

Expand All @@ -487,7 +494,10 @@ def cloud_put(
)

payload_bytes = b"" if payload is None else json.dumps(payload).encode("utf-8")
reply = self._nam.put(request, payload_bytes)

with disable_nam_timeout(self._nam):
reply = self._nam.put(request, payload_bytes)

reply.sslErrors.connect(lambda sslErrors: reply.ignoreSslErrors(sslErrors))
reply.setParent(self)

Expand All @@ -511,7 +521,9 @@ def cloud_patch(

payload_bytes = b"" if payload is None else json.dumps(payload).encode("utf-8")

reply = self._nam.sendCustomRequest(request, b"PATCH", payload_bytes)
with disable_nam_timeout(self._nam):
reply = self._nam.sendCustomRequest(request, b"PATCH", payload_bytes)

reply.sslErrors.connect(lambda sslErrors: reply.ignoreSslErrors(sslErrors))
reply.setParent(self)

Expand All @@ -531,7 +543,9 @@ def cloud_delete(self, uri: Union[str, List[str]]) -> QNetworkReply:
b"Authorization", "Token {}".format(self._token).encode("utf-8")
)

reply = self._nam.deleteResource(request)
with disable_nam_timeout(self._nam):
reply = self._nam.deleteResource(request)

reply.sslErrors.connect(lambda sslErrors: reply.ignoreSslErrors(sslErrors))
reply.setParent(self)

Expand Down

0 comments on commit 73c3234

Please sign in to comment.