Skip to content

Commit 7352691

Browse files
Merge pull request #625 from adamtheturtle/customisable-time
Document the 500 response for querying deleted targets
2 parents 797ec12 + a56a1e6 commit 7352691

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

CONTRIBUTING.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ However, the maximum allowed value is 50.
176176

177177
A response to an invalid query may have an ``application/json`` content type but include text (not JSON) data.
178178

179+
After deleting a target, for up to approximately 30 seconds, matching it with a query returns a 500 response.
180+
179181
Performing a release
180182
--------------------
181183

README.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ Matching a target which is in the processing state sometimes returns a successfu
177177
Sometimes a 500 (INTERNAL SERVER ERROR) response is given.
178178
The mock always gives a 500 response.
179179

180+
Matching deleted targets
181+
~~~~~~~~~~~~~~~~~~~~~~~~
182+
183+
Matching a target which has been deleted returns a 500 (INTERNAL SERVER ERROR) response within the first few seconds.
184+
This timeframe is not consistent on the real Vuforia Web Services.
185+
On the mock, this timeframe is always three seconds.
186+
180187
.. |Build Status| image:: https://travis-ci.org/adamtheturtle/vws-python.svg?branch=master
181188
:target: https://travis-ci.org/adamtheturtle/vws-python
182189
.. |codecov| image:: https://codecov.io/gh/adamtheturtle/vws-python/branch/master/graph/badge.svg

src/mock_vws/_mock_web_query_api.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,15 @@ def __init__(
462462
secret_key (str): A VWS client secret key.
463463
mock_web_services_api (MockVuforiaWebServicesAPI): An instance of a
464464
mock web services API.
465+
query_recognizes_deletion_seconds (int): The number of seconds
466+
after a target has been deleted that the query endpoint will
467+
return a 500 response for on a match.
465468
"""
466469
self.routes: Set[Route] = ROUTES
467470
self.access_key: str = client_access_key
468471
self.secret_key: str = client_secret_key
469472
self.mock_web_services_api = mock_web_services_api
473+
self.query_recognizes_deletion_seconds = 3
470474

471475
@route(path_pattern='/v1/query', http_methods=[POST])
472476
def query(
@@ -497,9 +501,9 @@ def query(
497501
gmt = pytz.timezone('GMT')
498502
now = datetime.datetime.now(tz=gmt)
499503

500-
# See https://github.com/adamtheturtle/vws-python/issues/623 for making
501-
# this customizable.
502-
minimum_time_since_delete = datetime.timedelta(seconds=3)
504+
minimum_time_since_delete = datetime.timedelta(
505+
seconds=self.query_recognizes_deletion_seconds,
506+
)
503507

504508
for target in self.mock_web_services_api.targets:
505509
delete_processing = bool(

0 commit comments

Comments
 (0)