pyobs-core 2.0.0.dev33__py3-none-any.whl → 2.0.0.dev35__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.
pyobs/comm/comm.py CHANGED
@@ -663,7 +663,27 @@ class Comm:
663
663
  # handle it
664
664
  ret = handler(event, from_client)
665
665
  if asyncio.iscoroutine(ret):
666
- asyncio.create_task(ret)
666
+ task = asyncio.create_task(ret)
667
+ task.add_done_callback(functools.partial(self._log_handler_exception, handler=handler, event=event))
668
+
669
+ @staticmethod
670
+ def _log_handler_exception(task: asyncio.Task[Any], handler: Callable[..., Any], event: Event) -> None:
671
+ """Log an event handler's exception with context, instead of leaving it to asyncio's own
672
+ "Task exception was never retrieved" warning at garbage-collection time, which gives no
673
+ indication of which handler or event actually failed -- every event handler is dispatched
674
+ as a fire-and-forget task (see _send_event_to_module), so this is the only place any of
675
+ them get their exceptions surfaced at all.
676
+ """
677
+ if task.cancelled():
678
+ return
679
+ exc = task.exception()
680
+ if exc is not None:
681
+ log.error(
682
+ "Unhandled exception in event handler %s for %s.",
683
+ getattr(handler, "__qualname__", handler),
684
+ event.__class__.__name__,
685
+ exc_info=exc,
686
+ )
667
687
 
668
688
 
669
689
  __all__ = ["Comm"]
@@ -844,7 +844,12 @@ class XmppComm(Comm):
844
844
  Return value from method.
845
845
  """
846
846
 
847
- # try multiple times
847
+ # try multiple times -- unlike _get_capabilities/_subscribe_with_retry this still gives up
848
+ # after a fixed budget instead of retrying indefinitely, since some callers run from open()
849
+ # and need to know a send failed rather than hang forever (see #664/#666). But the wait
850
+ # between attempts is jittered for the same reason as those: many modules' _safe_send calls
851
+ # can end up retrying around the same moment (e.g. a fleet-wide restart), and a fixed wait
852
+ # keeps them all retrying in lockstep instead of spreading the load out.
848
853
  iq = None
849
854
  for i in range(self._safe_send_attempts):
850
855
  try:
@@ -857,11 +862,11 @@ class XmppComm(Comm):
857
862
  except slixmpp.exceptions.IqTimeout as timeout:
858
863
  # timeout occurred, try again after some wait
859
864
  iq = timeout.iq
860
- await asyncio.sleep(self._safe_send_wait)
865
+ await asyncio.sleep(_retry_delay(i + 1, cap=self._safe_send_wait * 4, base=self._safe_send_wait))
861
866
 
862
867
  except TimeoutError:
863
868
  # our own timeout fired instead of slixmpp's, try again after some wait
864
- await asyncio.sleep(self._safe_send_wait)
869
+ await asyncio.sleep(_retry_delay(i + 1, cap=self._safe_send_wait * 4, base=self._safe_send_wait))
865
870
 
866
871
  # never should reach this
867
872
  raise slixmpp.exceptions.IqTimeout(iq)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyobs-core
3
- Version: 2.0.0.dev33
3
+ Version: 2.0.0.dev35
4
4
  Summary: robotic telescope software
5
5
  Author-email: Tim-Oliver Husser <thusser@uni-goettingen.de>
6
6
  License-Expression: MIT
@@ -10,7 +10,7 @@ pyobs/cli/pyobs.py,sha256=h4XrVrk3kwFu5h-3b7qIpIxYyhdBkwPdhttgGsB7Ztg,3643
10
10
  pyobs/cli/pyobsd.py,sha256=maIaJY4DrbmI6Zr9yypSnEUNjoiWV25ldwSy08E4ATE,16089
11
11
  pyobs/cli/pyobsw.py,sha256=uXrJoz8fpGjADPUyf0-MxNcCKqVK2PkI8i9TWS-VS7w,740
12
12
  pyobs/comm/__init__.py,sha256=Pc_hlxXLcVf5sWtf_wCJ9PbC1_sGJHaNsF6qWBEQJzU,1567
13
- pyobs/comm/comm.py,sha256=z4JgMsRKrPQEFKQ2JmrtaIVn0a9c1LVrZ6-aYNR520s,24308
13
+ pyobs/comm/comm.py,sha256=yWijexMdfnFxGSir10iZENC-2tk-fNG4zfyeDEDQyX0,25355
14
14
  pyobs/comm/commlogging.py,sha256=ycilwfEnCfEDY8Ya9_a5y9TqMsk6alFP8QQbWsIwHrU,1273
15
15
  pyobs/comm/proxy.py,sha256=38R5vIe9PVQotMaA010f83Q819KWeYR3kFkL7Xj3Cng,8277
16
16
  pyobs/comm/dummy/__init__.py,sha256=TwLSVExj81QPeIsd-pQR_FRRDWk-ueaCKITywxdW9l4,58
@@ -22,7 +22,7 @@ pyobs/comm/xmpp/__init__.py,sha256=U8A_ZAdKS3qH-SjdzZ28tEBzCrnnpAL3qrfoEl92Q_E,5
22
22
  pyobs/comm/xmpp/rpc.py,sha256=gUenqPK3FedaJCFOxc-uJ_bqokmkyXkoQ2wk2mkZrk8,14917
23
23
  pyobs/comm/xmpp/serializer.py,sha256=HFCPuzWIp3lnnJH_8WHiagzVUQaXyJEhKw6wZ1uPnw0,18999
24
24
  pyobs/comm/xmpp/xmppclient.py,sha256=d-5NqQ2ZXBFiyLbqdaJHrXVNrS4Z_19Zrnnjtsd_Fcs,7940
25
- pyobs/comm/xmpp/xmppcomm.py,sha256=evMiP5oSXXJx2aoeoNDZdsjM2WWTJmsznGKpzJVVsBM,46791
25
+ pyobs/comm/xmpp/xmppcomm.py,sha256=fn3ygQtQNCf_sKicPSSzcjPzln665Wr83OZyHUxuolw,47449
26
26
  pyobs/comm/xmpp/xep_0009/__init__.py,sha256=YbgcfeEcRH-M3HQ0IyHEPhPLHIj8xcWYKHSRYIIuX8k,103
27
27
  pyobs/comm/xmpp/xep_0009/binding.py,sha256=bbBwpc68e9hkt9hwU8AE_OHpt-Rpakl6JvNAg2xFHZM,5995
28
28
  pyobs/comm/xmpp/xep_0009/rpc.py,sha256=_Xzzghl4yDsdVwjL3QjmgzaiqAYhQN0y9R4vlYnTinw,2067
@@ -439,8 +439,8 @@ pyobs/vfs/vfs.py,sha256=buHTmO6VUjSypkEMVxY8rDKrpMz65AY2OE2hGEsQsLI,10780
439
439
  pyobs/vfs/filelists/__init__.py,sha256=NaTGFjLGh043j_F7kWEx_cXaII7t3CbYguRk2g5hEqw,111
440
440
  pyobs/vfs/filelists/filelist.py,sha256=kCco_5G2gLH-nxWik-wcs6lGuc_-3LeeyR9L4_srf30,201
441
441
  pyobs/vfs/filelists/testing.py,sha256=M8f2BULdjRCc7JFOKhAH7Kwre_uVQC0xLcv9xGTfNFw,425
442
- pyobs_core-2.0.0.dev33.dist-info/METADATA,sha256=2Olhqmx2UC2RvWVLS3XwpTf3IPObJWC3YWLxv8yrpTs,1990
443
- pyobs_core-2.0.0.dev33.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
444
- pyobs_core-2.0.0.dev33.dist-info/entry_points.txt,sha256=0ceIn3dTDwWdGdJ5VdTvYim7vKkdTe6aqqpoaG065UY,109
445
- pyobs_core-2.0.0.dev33.dist-info/licenses/LICENSE,sha256=gC8djBliCENDmuRvzCoejpWbsn8eqKx61Hc8bmDZ2LI,1099
446
- pyobs_core-2.0.0.dev33.dist-info/RECORD,,
442
+ pyobs_core-2.0.0.dev35.dist-info/METADATA,sha256=eDZCP4-8pQGk0ZKlg5q_kip1tHozwfCQ0rMCOpld5Po,1990
443
+ pyobs_core-2.0.0.dev35.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
444
+ pyobs_core-2.0.0.dev35.dist-info/entry_points.txt,sha256=0ceIn3dTDwWdGdJ5VdTvYim7vKkdTe6aqqpoaG065UY,109
445
+ pyobs_core-2.0.0.dev35.dist-info/licenses/LICENSE,sha256=gC8djBliCENDmuRvzCoejpWbsn8eqKx61Hc8bmDZ2LI,1099
446
+ pyobs_core-2.0.0.dev35.dist-info/RECORD,,