fix addpeer
This commit is contained in:
parent
5a417baf16
commit
c66433c740
2 changed files with 9 additions and 3 deletions
|
@ -302,6 +302,7 @@ class Changelog(db.Model):
|
|||
|
||||
@classmethod
|
||||
def aggregated_changes(cls, since=None, user_id=None):
|
||||
from item.models import Item
|
||||
from user.models import List
|
||||
if not user_id:
|
||||
user_id = settings.USER_ID
|
||||
|
@ -325,6 +326,9 @@ class Changelog(db.Model):
|
|||
action[item_id] = [revision, timestamp, info]
|
||||
if item_id in changes.get('removeitem', []):
|
||||
del changes['removeitem'][item_id]
|
||||
i = Item.get(item_id)
|
||||
if i:
|
||||
changes.setdefault('edititem', {})[item_id] = [revision+1, timestamp, i.meta]
|
||||
elif op == 'edititem':
|
||||
item_id = data[1]
|
||||
meta = data[2]
|
||||
|
@ -413,8 +417,8 @@ class Changelog(db.Model):
|
|||
pass
|
||||
elif op == 'addpeer':
|
||||
peer = data[1]
|
||||
info = data[2]
|
||||
action[peer] = [timestamp, info]
|
||||
username = data[2]
|
||||
action[peer] = [revision, timestamp, username]
|
||||
if peer in changes.get('removepeer', []):
|
||||
del changes['removepeer'][peer]
|
||||
elif op == 'removepeer':
|
||||
|
|
|
@ -54,6 +54,7 @@ class Node(Thread):
|
|||
self._pull = PeriodicCallback(self.pull, 60000)
|
||||
self._pull.start()
|
||||
self.ping()
|
||||
self.pull()
|
||||
|
||||
def run(self):
|
||||
while self._running:
|
||||
|
@ -68,7 +69,8 @@ class Node(Thread):
|
|||
elif action == 'pull':
|
||||
self._pulling = True
|
||||
self.online = self.can_connect()
|
||||
self.pullChanges()
|
||||
if self.online:
|
||||
self.pullChanges()
|
||||
self._pulling = False
|
||||
else:
|
||||
logger.debug('unknown action %s', action)
|
||||
|
|
Loading…
Reference in a new issue