Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
minenwerfer committed Jan 12, 2024
1 parent 4a4d048 commit f0408b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ enqueue = setup(instance, {
]
})

enqueue('TESTCHAN_1', 'my_package.my_module.func_name')
enqueue('TESTCHAN_2', 'my_package.my_module.func_name', 'positional argument', 42, named_arg='Hey!')
# the third positional parameter is a integer (or None) representing the timeout in seconds
# after the timeout is reached the function subprocess will be killed
enqueue('TESTCHAN_1', 'my_package.my_module.func_name' 0)
enqueue('TESTCHAN_2', 'my_package.my_module.func_name', 0, 'positional argument', 42, named_arg='Hey!')
# ...

# do some blocking stuff
Expand Down
6 changes: 5 additions & 1 deletion src/daemonless_queuing/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ def treat_list(action: str, *args: typing.Any):
result: list[bool] = []
for k in key:
result.append(getattr(instance, action)(k, *args))
return reduce(lambda a, b : a and b, typing.cast(typing.Any, result))

def acc(a: bool, b: bool):
return a and b

return reduce(acc, typing.cast(typing.Any, result))

return getattr(instance, action)(key, *args)

Expand Down

0 comments on commit f0408b1

Please sign in to comment.