Skip to content
This repository has been archived by the owner on May 14, 2021. It is now read-only.

ECO-475/ Auto create channel #23

Merged
merged 7 commits into from
Jul 8, 2018
Merged

ECO-475/ Auto create channel #23

merged 7 commits into from
Jul 8, 2018

Conversation

doodyparizada
Copy link
Contributor

@doodyparizada doodyparizada commented Jul 8, 2018

Blockchain access is divided into read and write.
read access is done via @staticmethods, while write access is given for short actions and requires accessing a lock.
The lock acquires a channel from redis, creates it if it isn't created or tops it up if it is low in funds and then uses it for the operation.
This allows for 20 (configurable) concurrent write requests at the same time.

payment/queue.py Outdated
@@ -118,7 +126,8 @@ def pay_and_callback(payment_request: dict):
"""lock, try to pay and callback."""
log.info('pay_and_callback recieved', payment_request=payment_request)
payment_request = PaymentRequest(payment_request)
with lock(redis_conn, 'payment:{}'.format(payment_request.id)):
with redis_conn.lock('lock:payment:{}'.format(payment_request.id),
timeout=120, blocking_timeout=120):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is broken

@doodyparizada doodyparizada merged commit ff3e061 into master Jul 8, 2018
@doodyparizada doodyparizada deleted the auto_create_channel branch July 8, 2018 15:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant