Skip to content

Commit

Permalink
Only delete the cache when we're ready to recreate it
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamgilbert committed Jun 28, 2018
1 parent f1425a0 commit a2fadee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sal/version.plist
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>version</key>
<string>3.3.7.1514</string>
<string>3.3.7.1515</string>
</dict>
</plist>
4 changes: 3 additions & 1 deletion search/management/commands/search_maintenance.py
Expand Up @@ -55,7 +55,8 @@ def handle(self, *args, **options):
app_versions = Application.objects.values('name', 'bundleid').distinct()

old_cache = SearchFieldCache.objects.all()
old_cache.delete()
if server.utils.is_postgres() is False:
old_cache.delete()
for f in Machine._meta.fields:
if f.name not in skip_fields:
cached_item = SearchFieldCache(search_model='Machine', search_field=f.name)
Expand Down Expand Up @@ -112,6 +113,7 @@ def handle(self, *args, **options):
cached_item.save()

if server.utils.is_postgres() is True:
old_cache.delete()
SearchFieldCache.objects.bulk_create(search_fields)

# make sure this in an int:
Expand Down

0 comments on commit a2fadee

Please sign in to comment.