forked from goodboy/tractor
1
0
Fork 0

Ignore `greenback` import error if not installed

multihomed
Tyler Goodlet 2023-10-19 12:41:15 -04:00
parent 9da3b63644
commit 2f0bed3018
1 changed files with 17 additions and 14 deletions

View File

@ -836,22 +836,25 @@ async def pause(
# runtime aware version which takes care of all . # runtime aware version which takes care of all .
def pause_from_sync() -> None: def pause_from_sync() -> None:
print("ENTER SYNC PAUSE") print("ENTER SYNC PAUSE")
import greenback try:
__tracebackhide__ = True import greenback
__tracebackhide__ = True
actor: tractor.Actor = tractor.current_actor() actor: tractor.Actor = tractor.current_actor()
# task_can_release_tty_lock = trio.Event() # task_can_release_tty_lock = trio.Event()
# spawn bg task which will lock out the TTY, we poll # spawn bg task which will lock out the TTY, we poll
# just below until the release event is reporting that task as # just below until the release event is reporting that task as
# waiting.. not the most ideal but works for now ;) # waiting.. not the most ideal but works for now ;)
greenback.await_( greenback.await_(
actor._service_n.start(partial( actor._service_n.start(partial(
pause, pause,
debug_func=None, debug_func=None,
# release_lock_signal=task_can_release_tty_lock, # release_lock_signal=task_can_release_tty_lock,
)) ))
) )
except ModuleNotFoundError:
log.warning('NO GREENBACK FOUND')
db, undo_sigint = mk_mpdb() db, undo_sigint = mk_mpdb()
Lock.local_task_in_debug = 'sync' Lock.local_task_in_debug = 'sync'