Skip to content

Commit

Permalink
move celery task start to manage command
Browse files Browse the repository at this point in the history
  • Loading branch information
chepe4pi committed Nov 18, 2016
1 parent 3d15b36 commit fec842f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
21 changes: 21 additions & 0 deletions app_core/management/commands/start_block_monitor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from django.core.management.base import BaseCommand, CommandError

from ethereum_scanner.celery import set_web3_filter_task


class Command(BaseCommand):
help = 'Sync local database with blockchain from current position to end block'

def add_arguments(self, parser):
parser.add_argument('async', nargs='?', default='async')

# TODO logger - synced
def handle(self, *args, **options):

async_start = options['async']
if async_start is 'async':
set_web3_filter_task.delay()
self.stdout.write(self.style.SUCCESS('Successfully sync started'))
else:
set_web3_filter_task()
self.stdout.write(self.style.SUCCESS('Successfully synced'))
1 change: 0 additions & 1 deletion ethereum_scanner/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ def sync_blocks_from_position_to_end():

if __name__ == '__main__':
app.start()
set_web3_filter_task.delay()

0 comments on commit fec842f

Please sign in to comment.