mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-23 03:38:08 -06:00
Call shelf for sessions every 5 minutes
This commit is contained in:
parent
7bc26a94c7
commit
7f3c363da8
@ -249,6 +249,8 @@ class Controller(object):
|
|||||||
# Connection checker executed each minute.
|
# Connection checker executed each minute.
|
||||||
self.checker_function = RepeatingTimer(60, self.check_connection)
|
self.checker_function = RepeatingTimer(60, self.check_connection)
|
||||||
self.checker_function.start()
|
self.checker_function.start()
|
||||||
|
self.save_db = RepeatingTimer(300, self.save_data_in_db)
|
||||||
|
self.save_db.start()
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
""" Starts all buffer objects. Loads their items."""
|
""" Starts all buffer objects. Loads their items."""
|
||||||
@ -1495,3 +1497,7 @@ class Controller(object):
|
|||||||
for i in self.buffers:
|
for i in self.buffers:
|
||||||
if hasattr(i, "remove_tweet") and hasattr(i, "name"):
|
if hasattr(i, "remove_tweet") and hasattr(i, "name"):
|
||||||
i.remove_tweet(id)
|
i.remove_tweet(id)
|
||||||
|
|
||||||
|
def save_data_in_db(self):
|
||||||
|
for i in session_.sessions:
|
||||||
|
session_.sessions[i].shelve()
|
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
""" The main session object. Here are the twitter functions to interact with the "model" of TWBlue."""
|
""" The main session object. Here are the twitter functions to interact with the "model" of TWBlue."""
|
||||||
import urllib2
|
import urllib2
|
||||||
|
import config
|
||||||
import twitter
|
import twitter
|
||||||
from keys import keyring
|
from keys import keyring
|
||||||
import session_exceptions as Exceptions
|
import session_exceptions as Exceptions
|
||||||
@ -425,7 +426,7 @@ class Session(object):
|
|||||||
|
|
||||||
def check_quoted_status(self, tweet):
|
def check_quoted_status(self, tweet):
|
||||||
status = tweets.is_long(tweet)
|
status = tweets.is_long(tweet)
|
||||||
if status != False:
|
if status != False and config.app["app-settings"]["handle_longtweets"]:
|
||||||
tweet = self.get_quoted_tweet(tweet)
|
tweet = self.get_quoted_tweet(tweet)
|
||||||
return tweet
|
return tweet
|
||||||
|
|
||||||
@ -447,6 +448,6 @@ class Session(object):
|
|||||||
|
|
||||||
def check_long_tweet(self, tweet):
|
def check_long_tweet(self, tweet):
|
||||||
long = twishort.is_long(tweet)
|
long = twishort.is_long(tweet)
|
||||||
if long != False:
|
if long != False and config.app["app-settings"]["handle_longtweets"]:
|
||||||
tweet["message"] = twishort.get_full_text(long)
|
tweet["message"] = twishort.get_full_text(long)
|
||||||
return tweet
|
return tweet
|
Loading…
Reference in New Issue
Block a user