Removed all gc code that deleted incomplete addons (see bug 670295)
This commit is contained in:
Родитель
f8f353f6cf
Коммит
c814b4f5a4
|
@ -9,7 +9,6 @@ import commonware.log
|
|||
|
||||
import amo
|
||||
from amo.utils import chunked
|
||||
from addons.models import Addon
|
||||
from addons.utils import AdminActivityLogMigrationTracker
|
||||
from bandwagon.models import Collection
|
||||
from cake.models import Session
|
||||
|
@ -46,22 +45,14 @@ def gc(test_result=True):
|
|||
created__lt=days_ago(2), type=amo.COLLECTION_ANONYMOUS)
|
||||
.values_list('id', flat=True))
|
||||
|
||||
# Remove Incomplete add-ons older than 4 days.
|
||||
addons_to_delete = (Addon.objects.filter(
|
||||
highest_status=amo.STATUS_NULL, status=amo.STATUS_NULL,
|
||||
created__lt=days_ago(4))
|
||||
.values_list('id', flat=True))
|
||||
|
||||
for chunk in chunked(logs, 100):
|
||||
tasks.delete_logs.delay(chunk)
|
||||
for chunk in chunked(contributions_to_delete, 100):
|
||||
tasks.delete_stale_contributions.delay(chunk)
|
||||
for chunk in chunked(collections_to_delete, 100):
|
||||
tasks.delete_anonymous_collections.delay(chunk)
|
||||
# Incomplete addons cannot be deleted because when an addon is rejected
|
||||
# during a review it is marked as incomplete. See bug 670295.
|
||||
# for chunk in chunked(addons_to_delete, 100):
|
||||
# tasks.delete_incomplete_addons.delay(chunk)
|
||||
# Incomplete addons cannot be deleted here because when an addon is
|
||||
# rejected during a review it is marked as incomplete. See bug 670295.
|
||||
|
||||
log.debug('Cleaning up sharing services.')
|
||||
AddonShareCount.objects.exclude(
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
import nose
|
||||
import test_utils
|
||||
from nose.tools import eq_
|
||||
|
||||
import amo
|
||||
from amo.cron import gc
|
||||
from addons.models import Addon, AddonCategory, Category
|
||||
from bandwagon.models import Collection
|
||||
from cake.models import Session
|
||||
from devhub.models import ActivityLog
|
||||
|
@ -33,12 +28,3 @@ class GarbageTest(test_utils.TestCase):
|
|||
eq_(TestResultCache.objects.all().count(), 0)
|
||||
eq_(AddonShareCount.objects.all().count(), 0)
|
||||
eq_(Contribution.objects.all().count(), 0)
|
||||
|
||||
def test_incomplete(self):
|
||||
raise nose.SkipTest()
|
||||
a = Addon.objects.create(status=0, highest_status=0, type=1)
|
||||
a.created = datetime.today() - timedelta(days=5)
|
||||
a.save()
|
||||
assert Addon.objects.filter(status=0, highest_status=0)
|
||||
gc()
|
||||
assert not Addon.objects.filter(status=0, highest_status=0)
|
||||
|
|
Загрузка…
Ссылка в новой задаче