def auto_update(self): query=NicoTrackerRec().all()#db.Query(NicoTrackerRec,keys_only=True) query=query.order("date") #古い順 update_unit=100 #out of timeにならない範囲で取得 #100*24times=2400件が毎日更新できるリミット rec_list=query.fetch(limit=update_unit) #rec_list=db.get(rec_list) cnt=0 update_cnt=0 update_list=[] for rec in rec_list: #get and update rec=self.update_core(rec,False,True) if(rec and rec.updated): update_cnt=update_cnt+1 update_list.append(rec) #rec=None #release memory #next if(len(update_list)>=20): db.put(update_list) update_list=[] #release memory cnt=cnt+1 #if(cnt%100==0): # logging.info("update nico_tracker "+str(cnt)) if(len(update_list)>=1): db.put(update_list) update_list=[] #if(update_cnt): # db.put(rec_list) logging.info("updated "+str(update_cnt)+" of "+str(cnt)) gc.collect()