forked from uncloud/uncloud
++stuff
This commit is contained in:
parent
0708a1e1fd
commit
4df7c761d3
4 changed files with 30 additions and 0 deletions
|
@ -0,0 +1,29 @@
|
|||
import time
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from uncloud_api import models
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
args = '<None>'
|
||||
help = 'VM Snapshot support'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('command', type=str, help='Command')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
print("Snapshotting")
|
||||
#getattr(self, options['command'])(**options)
|
||||
|
||||
@classmethod
|
||||
def monitor(cls, **_):
|
||||
while True:
|
||||
try:
|
||||
tweets = models.Reply.get_target_tweets()
|
||||
responses = models.Reply.objects.values_list('tweet_id', flat=True)
|
||||
new_tweets = [x for x in tweets if x.id not in responses]
|
||||
models.Reply.send(new_tweets)
|
||||
except TweepError as e:
|
||||
print(e)
|
||||
time.sleep(60)
|
|
@ -49,6 +49,7 @@ class Order(models.Model):
|
|||
on_delete=models.CASCADE)
|
||||
|
||||
|
||||
|
||||
class OrderReference(models.Model):
|
||||
"""
|
||||
An order can references another product / relate to it.
|
||||
|
|
Loading…
Reference in a new issue