from ..extensions import celery, redis_store
from APITaxi_models.taxis import TaxiRedis
from time import time
from flask import current_app

@celery.task(name='clean_geoindex_timestamps')
def clean_geoindex_timestamps():
    max_time = time() - TaxiRedis._DISPONIBILITY_DURATION
    redis_store.zremrangebyscore(current_app.config['REDIS_TIMESTAMPS'],
        0, max_time)
    redis_store.zinterstore(current_app.config['REDIS_GEOINDEX'], 
                            {current_app.config['REDIS_GEOINDEX']:1,
                             current_app.config['REDIS_TIMESTAMPS']:0})

@@ -435,10 +435,9 @@
 X'%5D,
- 
 %0A
+
     
@@ -501,16 +501,16 @@
 EX'%5D:1,%0A
-
         
@@ -573,8 +573,539 @@
 S'%5D:0%7D)%0A
+    redis_store.zinterstore(current_app.config%5B'REDIS_NOT_AVAILABLE'%5D,%0A                            %7Bcurrent_app.config%5B'REDIS_NOT_AVAILABLE'%5D:1,%0A                             current_app.config%5B'REDIS_TIMESTAMPS'%5D:0%7D)%0A%0A    redis_store.zremrangebyscore(current_app.config%5B'REDIS_TIMESTAMPS_ID'%5D,%0A        0, max_time)%0A    redis_store.zinterstore(current_app.config%5B'REDIS_GEOINDEX_ID'%5D,%0A                            %7Bcurrent_app.config%5B'REDIS_GEOINDEX_ID'%5D:1,%0A                             current_app.config%5B'REDIS_TIMESTAMPS_ID'%5D:0%7D)%0A

Clean all indexes