-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cache_refresh always forces cache refresh
- Loading branch information
1 parent
eff2c2b
commit 02fad7b
Showing
1 changed file
with
4 additions
and
5 deletions.
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 |
---|---|---|
@@ -1,15 +1,14 @@ | ||
from django.core.cache import cache | ||
from django.core.management.base import BaseCommand, CommandError | ||
from django.test.client import RequestFactory | ||
|
||
from dogapi.views_api import get_repositories_status | ||
from dogapi.models import dog | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Refresh repository status cache' | ||
|
||
def handle(self, *args, **options): | ||
factory = RequestFactory() | ||
path = 'api/repostatus/' | ||
request = factory.get(path) | ||
get_repositories_status(request) | ||
repositories_status = dog.get_all_repositories_status() | ||
cache.set('repositories_status', repositories_status, 86400) | ||
self.stdout.write('Repository status refreshed') |