X-Git-Url: https://git.llucax.com/z.facultad/75.52/sercom.git/blobdiff_plain/fe57b6c5949830f40ce8bf4d096da1f34bc3d734..8debedef54a312adcb3daef5ad6a3a7a9696018d:/start-sercom.py diff --git a/start-sercom.py b/start-sercom.py index 0ec9722..6a3235b 100644 --- a/start-sercom.py +++ b/start-sercom.py @@ -25,7 +25,7 @@ elif exists(join(dirname(__file__), "setup.py")): else: update_config(configfile="prod.cfg",modulename="sercom.config") -from sercom.model import InstanciaDeEntrega, hub +from sercom.model import InstanciaDeEntrega, Entrega, AND, hub from sercom.finalizer import Finalizer from threading import Thread from datetime import datetime @@ -42,7 +42,9 @@ class Queue(object): #{{{ try: hub.begin() try: - select = InstanciaDeEntrega.selectBy(inicio_proceso=None) + select = InstanciaDeEntrega.select(AND( + InstanciaDeEntrega.q.inicio_proceso == None, + InstanciaDeEntrega.q.fin <= datetime.now())) instancia = select.orderBy(InstanciaDeEntrega.q.fin)[0] instancia.inicio_proceso = datetime.now() finally: