Skip to content

Commit 607e75c

Browse files
committed
Avoid redundant interactions with PubSub
1 parent 0da761a commit 607e75c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

backend/pubsub.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def publish(self, channel, message):
5757
"""
5858
Publish the message object to the channel.
5959
"""
60+
self.pubnub.unsubscribe().channels([channel]).execute()
6061
self.pubnub.publish().channel(channel).message(message).sync()
62+
self.pubnub.subscribe().channels([channel]).execute()
6163

6264
def broadcast_block(self, block):
6365
"""

backend/scripts/test_app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
from backend.wallet.wallet import Wallet
55

6-
BASE_URL = 'http://localhost:5000'
6+
BASE_URL = 'http://127.0.0.1:5000'
77

88
def get_blockchain():
99
return requests.get(f'{BASE_URL}/blockchain').json()
1010

1111
def get_blockchain_mine():
1212
return requests.get(f'{BASE_URL}/blockchain/mine').json()
1313

14-
def post_wallet_transact(recipient, amount):
14+
def post_wallet_transact(recipient, amount):
1515
return requests.post(
1616
f'{BASE_URL}/wallet/transact',
1717
json={ 'recipient': recipient, 'amount': amount }

0 commit comments

Comments
 (0)