Skip to content

Commit

Permalink
refactor(example): made exmaple bot more multi-process friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Sep 24, 2024
1 parent 303cef4 commit 216e470
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions bots/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@ async def grant_product(stream):
async def update_product_funding(stream):
# NOTE: properties of stream have changed, you may not need to handle this, but typically you
# would want to update `stream.time_left` in db for use in user Stream life notifications
db[stream.creator].pop(stream.stream_id)
db[stream.creator].insert(stream.stream_id, stream)
db[stream.creator][stream.stream_id] = stream
return stream.time_left


@sm.on_stream_cancelled(app)
async def revoke_product(stream):
print(f"unprovisioning product for {stream.creator}")
db[stream.creator].pop(stream.stream_id)
db[stream.creator].insert(stream.stream_id, None)
db[stream.creator][stream.stream_id] = None
return stream.time_left

0 comments on commit 216e470

Please sign in to comment.