Skip to content

Commit

Permalink
Include all requests in execution time
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryp Toon committed Nov 22, 2024
1 parent e0daef5 commit 9ecb5cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bitcoinlib/services/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def _provider_execute(self, method, *arguments):
if self.ignore_priority:
random.shuffle(provider_lst)

start_time = datetime.now()
for sp in provider_lst:
if self.resultcount >= self.max_providers:
break
Expand All @@ -193,9 +194,7 @@ def _provider_execute(self, method, *arguments):
_logger.debug("API key needed for provider %s" % sp)
continue
providermethod = getattr(pc_instance, method)
start_time = datetime.now()
res = providermethod(*arguments)
self.execution_time = (datetime.now() - start_time).total_seconds() * 1000
if res is False: # pragma: no cover
self.errors.update(
{sp: 'Received empty response'}
Expand Down Expand Up @@ -232,6 +231,7 @@ def _provider_execute(self, method, *arguments):
if self.resultcount >= self.max_providers:
break

self.execution_time = (datetime.now() - start_time).total_seconds() * 1000
if not self.resultcount:
raise ServiceError("No successful response from any serviceprovider: %s" % list(self.providers.keys()))
return list(self.results.values())[0]
Expand Down

0 comments on commit 9ecb5cf

Please sign in to comment.