diff --git a/docker-compose.yml b/docker-compose.yml index d615678..a6c83d8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,7 @@ services: # lucky: # build: ./docker/lucky # environment: - # steemnode: "steemd.steemit.com" + # steemnode: "api.steemit.com:443" development: build: ./docker/development # links: diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile index 17d4a1e..db42313 100644 --- a/docker/development/Dockerfile +++ b/docker/development/Dockerfile @@ -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 diff --git a/docker/live/live.py b/docker/live/live.py index e1f89de..a65fee7 100644 --- a/docker/live/live.py +++ b/docker/live/live.py @@ -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: @@ -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__':