Exemplo n.º 1
0
    def run(self, job):
        # Ensure sync hasn't already been triggered
        if not self.check(job):
            return False

        try:
            # Queue sync
            Sync.queue(account=job.account,
                       mode=SyncMode.Full,
                       priority=100,
                       trigger=SyncResult.Trigger.Schedule)
        except QueueError, ex:
            log.info('Queue error: %s', ex)
Exemplo n.º 2
0
    def run(self, job):
        # Ensure sync hasn't already been triggered
        if not self.check(job):
            return False

        try:
            # Queue sync
            Sync.queue(
                account=job.account,
                mode=SyncMode.Full,

                priority=100,
                trigger=SyncResult.Trigger.Schedule
            )
        except QueueError, ex:
            log.info('Queue error: %s', ex)
Exemplo n.º 3
0
    def run(cls, account_id, mode, t, **kwargs):
        # Check for duplicate trigger
        key = (account_id, mode, t)

        if key in cls.triggered:
            log.info('Ignored duplicate sync trigger action')
            return redirect('/sync', account_id=account_id)

        # Mark triggered
        cls.triggered[key] = True

        # Trigger sync
        try:
            Sync.queue(account_id, mode, **kwargs)
        except QueueError as ex:
            return redirect('/sync', account_id=account_id, title=ex.title, message=ex.message)

        return redirect('/sync', account_id=account_id)
Exemplo n.º 4
0
    def run(cls, account_id, mode, t, **kwargs):
        # Check for duplicate trigger
        key = (account_id, mode, t)

        if key in cls.triggered:
            log.info('Ignored duplicate sync trigger action')
            return redirect('/sync', account_id=account_id)

        # Mark triggered
        cls.triggered[key] = True

        # Trigger sync
        try:
            Sync.queue(account_id, mode, **kwargs)
        except QueueError, ex:
            return redirect('/sync',
                            account_id=account_id,
                            title=ex.title,
                            message=ex.message)
Exemplo n.º 5
0
def Trigger(account_id, mode, **kwargs):
    try:
        Sync.queue(account_id, mode, **kwargs)
    except QueueError, ex:
        return redirect('/sync', account_id=account_id, title=ex.title, message=ex.message)