added override of one month OL cache [#33377581]
parent
7bf94b3925
commit
184dfedda9
|
@ -444,8 +444,8 @@ def merge_works(w1, w2, user=None):
|
|||
w2.delete()
|
||||
|
||||
|
||||
def add_openlibrary(work):
|
||||
if work.openlibrary_lookup is not None:
|
||||
def add_openlibrary(work, hard_refresh = False):
|
||||
if (not hard_refresh) and work.openlibrary_lookup is not None:
|
||||
# don't hit OL if we've visited in the past month or so
|
||||
if now()- work.openlibrary_lookup < timedelta(days=30):
|
||||
return
|
||||
|
|
|
@ -10,4 +10,4 @@ class Command(BaseCommand):
|
|||
|
||||
for work in models.Work.objects.filter(description__contains='{'):
|
||||
print "updating work %s" % work
|
||||
bookloader.add_openlibrary(work)
|
||||
bookloader.add_openlibrary(work, hard_refresh = True)
|
||||
|
|
Loading…
Reference in New Issue