-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move celery task start to manage command
- Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,4 +44,3 @@ def sync_blocks_from_position_to_end(): | |
|
||
if __name__ == '__main__': | ||
app.start() | ||
set_web3_filter_task.delay() |