remove unused pushChanges
This commit is contained in:
parent
f6cfb255a6
commit
78e48e65bd
4 changed files with 0 additions and 37 deletions
|
@ -58,8 +58,6 @@ class Changelog(db.Model):
|
|||
_data = _data.encode()
|
||||
state.db.session.add(c)
|
||||
state.db.session.commit()
|
||||
#if state.nodes:
|
||||
# state.nodes.queue('peered', 'pushChanges', [c.json()])
|
||||
logger.debug('record change: %s', c.json())
|
||||
|
||||
@classmethod
|
||||
|
@ -78,8 +76,6 @@ class Changelog(db.Model):
|
|||
_data = _data.encode()
|
||||
state.db.session.add(c)
|
||||
state.db.session.commit()
|
||||
#if state.nodes:
|
||||
# state.nodes.queue('peered', 'pushChanges', [c.json()])
|
||||
logger.debug('record change: %s', c.json())
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
from changelog import Changelog
|
||||
from user.models import User
|
||||
from websocket import trigger_event
|
||||
import settings
|
||||
import state
|
||||
|
||||
import logging
|
||||
|
@ -24,27 +23,6 @@ def api_pullChanges(remote_id, user_id=None, from_=None, to=None):
|
|||
if user_id:
|
||||
return []
|
||||
return Changelog.aggregated_changes(from_)
|
||||
'''
|
||||
if not user_id:
|
||||
user_id = settings.USER_ID
|
||||
qs = Changelog.query.filter_by(user_id=user_id)
|
||||
if from_:
|
||||
qs = qs.filter(Changelog.revision>=from_)
|
||||
if to:
|
||||
qs = qs.filter(Changelog.revision<to)
|
||||
state.nodes.queue('add', remote_id)
|
||||
return [c.json() for c in qs]
|
||||
'''
|
||||
|
||||
def api_pushChanges(user_id, changes):
|
||||
logger.debug('pushChanges no longer used, ignored')
|
||||
return True
|
||||
user = User.get(user_id)
|
||||
if not Changelog.apply_changes(user, changes):
|
||||
logger.debug('FAILED TO APPLY CHANGE')
|
||||
state.nodes.queue(user_id, 'pullChanges')
|
||||
return False
|
||||
return True
|
||||
|
||||
def api_requestPeering(user_id, username, message):
|
||||
user = User.get_or_create(user_id)
|
||||
|
|
|
@ -175,7 +175,6 @@ class Handler(http.server.SimpleHTTPRequestHandler):
|
|||
'''
|
||||
API
|
||||
pullChanges [userid] from [to]
|
||||
pushChanges [index, change]
|
||||
requestPeering username message
|
||||
acceptPeering username message
|
||||
rejectPeering message
|
||||
|
|
10
oml/nodes.py
10
oml/nodes.py
|
@ -283,16 +283,6 @@ class Node(Thread):
|
|||
r = Changelog.apply_changes(u, changes)
|
||||
return r
|
||||
|
||||
def pushChanges(self, changes):
|
||||
logger.debug('pushing changes to %s %s', self.user_id, changes)
|
||||
if self.online:
|
||||
try:
|
||||
r = self.request('pushChanges', changes)
|
||||
except:
|
||||
self.online = False
|
||||
r = False
|
||||
logger.debug('pushedChanges %s %s', r, self.user_id)
|
||||
|
||||
def peering(self, action):
|
||||
with db.session():
|
||||
u = user.models.User.get_or_create(self.user_id)
|
||||
|
|
Loading…
Reference in a new issue