Commit 391666ea by Tu Nombre

se pone temporisador al server

1 parent b8e02ebf
from datetime import datetime
from services import serviceFactory from services import serviceFactory
from database import DBconnection from database import DBconnection
from enums import Services, States, Datatypes, Table from enums import Services, States, Datatypes, Table, datetime
import ipdb, os, json import ipdb, os, json
class Process: class Process:
...@@ -65,7 +64,7 @@ class Process: ...@@ -65,7 +64,7 @@ class Process:
self.stateMail.MailRompedor = [] self.stateMail.MailRompedor = []
def _send(self,state,serv): def _send(self,state,serv):
fin = datetime.now() + datetime.timedelta(seconds=15) fin = datetime.datetime.now() + datetime.datetime.timedelta(seconds=15)
rows = self.conn.query("SELECT * FROM msg WHERE state = ? and serv = ? ",(state,serv)) rows = self.conn.query("SELECT * FROM msg WHERE state = ? and serv = ? ",(state,serv))
if not len(rows) == 0: if not len(rows) == 0:
print("cantidad pendiente ", serv, len(rows)) print("cantidad pendiente ", serv, len(rows))
...@@ -99,7 +98,7 @@ class Process: ...@@ -99,7 +98,7 @@ class Process:
# parcialmente enviado # parcialmente enviado
elif partial: elif partial:
self.conn.query("UPDATE msg SET state = ?, type = ? WHERE id = ?",(States.partial,json.dumps(d),query[Table.id])) self.conn.query("UPDATE msg SET state = ?, type = ? WHERE id = ?",(States.partial,json.dumps(d),query[Table.id]))
if datetime.now() > fin: if datetime.datetime.now() > fin:
print("corto para q no se haga larga proces linea 100") print("corto para q no se haga larga proces linea 100")
return() return()
# devuelve el estado de un mensaje, lo archiva si está enviado # devuelve el estado de un mensaje, lo archiva si está enviado
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!