Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Luciano Barletta
/
message-service
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
1
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit b8e02ebf
authored
2020-07-29 19:45:10 -0300
by
Tu Nombre
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
se pone temporisador al server
1 parent
ac1ccff1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
Wpp1State.py
process.py
Wpp1State.py
View file @
b8e02eb
...
@@ -48,6 +48,7 @@ class StateMail():
...
@@ -48,6 +48,7 @@ class StateMail():
def
__init__
(
self
):
def
__init__
(
self
):
self
.
Consultas
=
{}
#{MailUSer-pass-host-str(port):{"hora": datetime.datetime.now, "estado": self.chequear_stado_WB(telefono)},}
self
.
Consultas
=
{}
#{MailUSer-pass-host-str(port):{"hora": datetime.datetime.now, "estado": self.chequear_stado_WB(telefono)},}
self
.
MailRompedor
=
[]
self
.
MailRompedor
=
[]
self
.
MailEnviado
=
{}
def
chequear_stado_Server
(
self
,
User
,
Pass
,
Port
,
Host
):
def
chequear_stado_Server
(
self
,
User
,
Pass
,
Port
,
Host
):
try
:
try
:
...
...
process.py
View file @
b8e02eb
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
...
@@ -64,7 +65,7 @@ class Process:
...
@@ -64,7 +65,7 @@ class Process:
self
.
stateMail
.
MailRompedor
=
[]
self
.
stateMail
.
MailRompedor
=
[]
def
_send
(
self
,
state
,
serv
):
def
_send
(
self
,
state
,
serv
):
salio
=
0
fin
=
datetime
.
now
()
+
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
))
...
@@ -76,7 +77,6 @@ class Process:
...
@@ -76,7 +77,6 @@ class Process:
try
:
try
:
serv
=
serviceFactory
(
query
[
Table
.
serv
])
serv
=
serviceFactory
(
query
[
Table
.
serv
])
success
=
serv
.
send
(
query
,
self
.
statePhone
,
self
.
stateMail
)
#envia al servicio se salida
success
=
serv
.
send
(
query
,
self
.
statePhone
,
self
.
stateMail
)
#envia al servicio se salida
salio
=
salio
+
1
except
:
except
:
success
=
{
'texto'
:
False
}
success
=
{
'texto'
:
False
}
print
(
"Rompio el proseso de envio procces linea 82"
)
print
(
"Rompio el proseso de envio procces linea 82"
)
...
@@ -99,7 +99,7 @@ class Process:
...
@@ -99,7 +99,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
salio
>
20
:
if
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
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment