forked from 0x2620/pandora
dont save sessiondata twice, leads to datalost if run in web and celery process
This commit is contained in:
parent
159b6dc746
commit
f9c1e52dc7
2 changed files with 2 additions and 2 deletions
|
@ -94,7 +94,6 @@ class SessionData(models.Model):
|
||||||
except:
|
except:
|
||||||
self.location = ''
|
self.location = ''
|
||||||
pass
|
pass
|
||||||
super(SessionData, self).save()
|
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
if self.user:
|
if self.user:
|
||||||
|
@ -106,7 +105,6 @@ class SessionData(models.Model):
|
||||||
self.level = 0
|
self.level = 0
|
||||||
self.groupssort = None
|
self.groupssort = None
|
||||||
super(SessionData, self).save(*args, **kwargs)
|
super(SessionData, self).save(*args, **kwargs)
|
||||||
tasks.parse_data.delay(self.session_key)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_or_create(cls, request):
|
def get_or_create(cls, request):
|
||||||
|
@ -133,6 +131,7 @@ class SessionData(models.Model):
|
||||||
data.timesseen += 1
|
data.timesseen += 1
|
||||||
data.lastseen = datetime.now()
|
data.lastseen = datetime.now()
|
||||||
data.save()
|
data.save()
|
||||||
|
tasks.parse_data.delay(data.session_key)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def get_id(self):
|
def get_id(self):
|
||||||
|
|
|
@ -15,3 +15,4 @@ import models
|
||||||
def parse_data(key):
|
def parse_data(key):
|
||||||
session_data = models.SessionData.objects.get(session_key=key)
|
session_data = models.SessionData.objects.get(session_key=key)
|
||||||
session_data.parse_data()
|
session_data.parse_data()
|
||||||
|
session_data.save()
|
||||||
|
|
Loading…
Reference in a new issue