From 3081f6b5373ea8a0295b7f4f629fb0c341180283 Mon Sep 17 00:00:00 2001 From: vrde Date: Tue, 11 Oct 2016 17:24:50 +0200 Subject: [PATCH] Wrap queries with connection object --- bigchaindb/core.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bigchaindb/core.py b/bigchaindb/core.py index 7e395614..07b7a7bc 100644 --- a/bigchaindb/core.py +++ b/bigchaindb/core.py @@ -137,11 +137,11 @@ class Bigchain(object): # There is no other node to assign to new_assignee = self.me - response = r.table('backlog')\ - .get(transaction['id'])\ - .update({'assignee': new_assignee, - 'assignment_timestamp': time()}, - durability=durability).run(self.conn) + response = self.connection.run( + r.table('backlog') + .get(transaction['id']) + .update({'assignee': new_assignee, 'assignment_timestamp': time()}, + durability=durability)) return response def get_stale_transactions(self): @@ -151,9 +151,9 @@ class Bigchain(object): backlog after some amount of time specified in the configuration """ - return r.table('backlog')\ - .filter(lambda tx: time() - tx['assignment_timestamp'] > - self.backlog_reassign_delay).run(self.conn) + return self.connection.run( + r.table('backlog') + .filter(lambda tx: time() - tx['assignment_timestamp'] > self.backlog_reassign_delay)) def validate_transaction(self, transaction): """Validate a transaction.