Skip to content

Commit

Permalink
Merge pull request #6 from ktarasz/patch-1
Browse files Browse the repository at this point in the history
Retrievers parameters based on DEFAULT_RETRIEVERS_PARAMS
  • Loading branch information
dimka2014 committed Jan 14, 2019
2 parents 459b731 + fba34cc commit b6f4d46
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions openprocurement_client/resources/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from openprocurement_client.clients import APIResourceClientSync
from openprocurement_client.utils import get_response

from copy import deepcopy

DEFAULT_RETRIEVERS_PARAMS = {
'down_requests_sleep': 5,
Expand All @@ -36,7 +36,7 @@ class ResourceFeeder(object):
def __init__(self, host=DEFAULT_API_HOST, version=DEFAULT_API_VERSION,
key=DEFAULT_API_KEY, resource='tenders',
extra_params=DEFAULT_API_EXTRA_PARAMS,
retrievers_params=DEFAULT_RETRIEVERS_PARAMS, adaptive=False,
retrievers_params={}, adaptive=False,
with_priority=False):
super(ResourceFeeder, self).__init__()
LOGGER.info('Init Resource Feeder...')
Expand All @@ -47,8 +47,9 @@ def __init__(self, host=DEFAULT_API_HOST, version=DEFAULT_API_VERSION,
self.adaptive = adaptive

self.extra_params = extra_params
self.retrievers_params = retrievers_params
self.queue = PriorityQueue(maxsize=retrievers_params['queue_size'])
self.retrievers_params = deepcopy(DEFAULT_RETRIEVERS_PARAMS)
self.retrievers_params.update(retrievers_params)
self.queue = PriorityQueue(maxsize=self.retrievers_params['queue_size'])

self.forward_priority = 1 if with_priority else 0
self.backward_priority = 1000 if with_priority else 0
Expand Down

0 comments on commit b6f4d46

Please sign in to comment.