py-near 1.1.19__py3-none-any.whl → 1.1.20__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
py_near/providers.py CHANGED
@@ -69,28 +69,27 @@ class JsonProvider(object):
69
69
  last_block_ts = datetime.datetime.fromisoformat(
70
70
  data["sync_info"]["latest_block_time"]
71
71
  )
72
- is_syncing = (
73
- last_block_ts.timestamp()
74
- < datetime.datetime.utcnow().timestamp() - 60
72
+ diff = (
73
+ datetime.datetime.utcnow().timestamp()
74
+ - last_block_ts.timestamp()
75
75
  )
76
+ is_syncing = diff > 60
76
77
  else:
77
78
  is_syncing = False
78
- if not is_syncing:
79
- available_rpcs.append(
80
- (
81
- rpc_addr,
82
- datetime.datetime.utcnow().timestamp()
83
- - timestamp_start,
84
- )
85
- )
79
+ if is_syncing:
80
+ logger.error(f"Remove async RPC : {rpc_addr} ({diff})")
86
81
  continue
87
- if rpc_addr in self._available_rpcs:
88
- if r.status == 200:
89
- logger.error(f"Remove async RPC : {rpc_addr}")
90
- else:
91
- logger.error(
92
- f"Remove rpc because of error {r.status}: {rpc_addr}"
82
+ available_rpcs.append(
83
+ (
84
+ rpc_addr,
85
+ datetime.datetime.utcnow().timestamp()
86
+ - timestamp_start,
93
87
  )
88
+ )
89
+ else:
90
+ logger.error(
91
+ f"Remove rpc because of error {r.status}: {rpc_addr}"
92
+ )
94
93
  except Exception as e:
95
94
  if rpc_addr in self._available_rpcs:
96
95
  logger.error(f"Remove rpc: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py-near
3
- Version: 1.1.19
3
+ Version: 1.1.20
4
4
  Summary: Pretty simple and fully asynchronous framework for working with NEAR blockchain
5
5
  Author: pvolnov
6
6
  Author-email: petr@herewallet.app
@@ -20,10 +20,10 @@ py_near/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
20
20
  py_near/exceptions/exceptions.py,sha256=qG-aBYAsyCXcdzmZ84n9wVHCLkuWnd16XZTVprJfUVM,5462
21
21
  py_near/exceptions/provider.py,sha256=K-wexgjPJ8sw42JePwaP7R5dJEIn9DoFJRvVcURsx6s,7718
22
22
  py_near/models.py,sha256=JHoJdghtc25WDbf6kRPf6IIqVRq46upexMzmBPB1U40,9534
23
- py_near/providers.py,sha256=lZkk-YLZc8l_BQEgdfHsdoPfjXiukC1Wg90P3mt07Vw,12531
23
+ py_near/providers.py,sha256=LfGfEK6zFzRp3RgXNY70_LlCzZw4_JvvMd7w337_F1I,12431
24
24
  py_near/transactions.py,sha256=QAXegv2JpKISk92NaChtIH6-QPHrcWbrwdKH_lH4TsU,3186
25
25
  py_near/utils.py,sha256=FirRH93ydH1cwjn0-sNrZeIn3BRD6QHedrP2VkAdJ6g,126
26
- py_near-1.1.19.dist-info/LICENSE,sha256=I_GOA9xJ35FiL-KnYXZJdATkbO2KcV2dK2enRGVxzKM,1023
27
- py_near-1.1.19.dist-info/METADATA,sha256=GdhL0NeXc-7oKq0n1gOfEQAMofpgJcJiATn0iKbhDU0,4713
28
- py_near-1.1.19.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
29
- py_near-1.1.19.dist-info/RECORD,,
26
+ py_near-1.1.20.dist-info/LICENSE,sha256=I_GOA9xJ35FiL-KnYXZJdATkbO2KcV2dK2enRGVxzKM,1023
27
+ py_near-1.1.20.dist-info/METADATA,sha256=a8Setz2rDy24pHh9rS_6LiWhAJm-GAOAvP4VRiDy71A,4713
28
+ py_near-1.1.20.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
29
+ py_near-1.1.20.dist-info/RECORD,,