Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
# lucky:
# build: ./docker/lucky
# environment:
# steemnode: "steemd.steemit.com"
# steemnode: "api.steemit.com:443"
development:
build: ./docker/development
# links:
Expand Down
2 changes: 1 addition & 1 deletion docker/development/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ubuntu:16.04

ENV php_conf /etc/php/7.0/fpm/php.ini
ENV fpm_conf /etc/php/7.0/fpm/php-fpm.conf
ENV composer_hash 544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061
ENV composer_hash e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a

RUN apt-get update && apt-get install -y software-properties-common python-software-properties

Expand Down
33 changes: 22 additions & 11 deletions docker/live/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,18 @@ def getRelatedAccounts(self, opType, opData):

def register(self, client):
if client not in self.clients:
# print("registered client [{}]".format(client.peer))
self.subscribe(client, "blocks")
self.subscribe(client, "props")
self.subscribe(client, "state")
for x in range(1, 11):
previous = self.last_block_processed - 10 + x
self.publishBlock(previous)
self.clients.append(client)
try:
# print("registered client [{}]".format(client.peer))
self.subscribe(client, "blocks")
self.subscribe(client, "props")
self.subscribe(client, "state")
for x in range(1, 11):
previous = self.last_block_processed - 10 + x
self.publishBlock(previous)
self.clients.append(client)
except Exception as e:
print('error', e)
pass

def unregister(self, client):
if client in self.clients:
Expand All @@ -194,9 +198,16 @@ def subscribe(self, client, channel):
def publish(self, channel, opType, opData):
if channel in self.channels:
for c in self.channels[channel]:
data = json.dumps({opType: opData})
# print("publishing op '{}' [{}] to subscriber [{}] based on channel subscription [{}]".format(opType, data, c.peer, channel))
c.sendMessage(data.encode('utf8'))
clients = self.channels[channel][:]
for c in clients:
try:
data = json.dumps({opType: opData})
# print("publishing op '{}' [{}] to subscriber [{}] based on channel subscription [{}]".format(opType, data, c.peer, channel))
c.sendMessage(data.encode('utf8'))
except Exception as e:
print('error:', e)
self.channels[channel].remove(c)


if __name__ == '__main__':

Expand Down