omnata-plugin-runtime 0.4.6a102__tar.gz → 0.4.6a103__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.4.6a102
3
+ Version: 0.4.6a103
4
4
  Summary: Classes and common runtime components for building and running Omnata Plugins
5
5
  Author: James Weakley
6
6
  Author-email: james.weakley@omnata.com
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "omnata-plugin-runtime"
3
- version = "0.4.6-a102"
3
+ version = "0.4.6-a103"
4
4
  description = "Classes and common runtime components for building and running Omnata Plugins"
5
5
  authors = ["James Weakley <james.weakley@omnata.com>"]
6
6
  readme = "README.md"
@@ -354,10 +354,15 @@ class RetryWithLogging(Retry):
354
354
  """
355
355
  Adding extra logs before making a retry request
356
356
  """
357
- def __init__(self, *args: Any, thread_cancellation_token:threading.Event, **kwargs: Any) -> Any:
358
- self.thread_cancellation_token = thread_cancellation_token
357
+ def __init__(self, *args: Any, **kwargs: Any) -> Any:
358
+ self.thread_cancellation_token:Optional[threading.Event] = None
359
359
  return super().__init__(*args, **kwargs)
360
360
 
361
+ def new(self, **kw):
362
+ new_retry = super().new(**kw)
363
+ new_retry.thread_cancellation_token = self.thread_cancellation_token
364
+ return new_retry
365
+
361
366
  def sleep_for_retry(self, response=None):
362
367
  retry_after = self.get_retry_after(response)
363
368
  if retry_after:
@@ -406,13 +411,13 @@ class RateLimitedSession(requests.Session):
406
411
  self.statuses_to_include = statuses_to_include
407
412
 
408
413
  retry_strategy = RetryWithLogging(
409
- thread_cancellation_token=thread_cancellation_token,
410
414
  total=max_retries,
411
415
  backoff_factor=backoff_factor,
412
416
  status_forcelist=statuses_to_include,
413
417
  allowed_methods=["HEAD", "GET", "OPTIONS", "POST", "PUT", "DELETE"],
414
418
  respect_retry_after_header=respect_retry_after_header
415
419
  )
420
+ retry_strategy.thread_cancellation_token = thread_cancellation_token
416
421
  adapter = HTTPAdapter(max_retries=retry_strategy)
417
422
  self.mount("https://", adapter)
418
423
  self.mount("http://", adapter)