示例#1
0
 def cleanup_item(self):
     number = random.randint(1, 1000)
     likelihood = 10  # occurs with a probability of 1%
     if number < likelihood:
         ndb.delete_multi_async(self.fetch_keys_old_sessions(3))
         ndb.delete_multi_async(EnkiModelBackoffTimer.fetch_keys_old(3))
         ndb.delete_multi_async(EnkiModelTokenAuth.fetch_keys_expired())
         ndb.delete_multi_async(
             EnkiModelRestAPIConnectToken.fetch_expired())
         ndb.delete_multi_async(EnkiModelRestAPIDataStore.fetch_expired())
         ndb.delete_multi_async(
             EnkiModelTokenVerify.fetch_keys_old_tokens_by_types(
                 0.007, [
                     'loginaddconfirm_1', 'loginaddconfirm_2',
                     'loginaddconfirm_3'
                 ]))
         EnkiModelRestAPIDataStore.refresh_non_expiring()
         ndb.delete_multi_async(
             EnkiModelTokenVerify.fetch_keys_old_tokens_by_types(
                 1, ['emailsubscriptionconfirm']))
         ndb.delete_multi_async(EnkiModelBackoffTimer.fetch_keys_old(1))