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 aa0e252d
authored
2019-10-11 14:07:55 +0000
by
Luciano Barletta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
cleaning is now more robust, restarting service is safer
1 parent
c252d8fb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
deploy.py
process.py
deploy.py
View file @
aa0e252
...
@@ -123,10 +123,14 @@ def clean():
...
@@ -123,10 +123,14 @@ def clean():
now
=
datetime
.
datetime
.
now
()
now
=
datetime
.
datetime
.
now
()
for
folder
in
paths
:
for
folder
in
paths
:
# carpeta no existe, borrar mensaje
if
not
os
.
path
.
exists
(
folder
):
p
.
deletepath
(
folder
)
continue
mtime
=
os
.
path
.
getmtime
(
folder
)
mtime
=
os
.
path
.
getmtime
(
folder
)
# Si la carpeta existe por más de X segundos, borrala
# Si la carpeta existe por más de X segundos, borrala
if
int
(
now
.
strftime
(
"
%
Y
%
m
%
d
%
H
%
M
%
S"
))
-
int
(
time
.
strftime
(
"
%
Y
%
m
%
d
%
H
%
M
%
S"
))
>
operation_timer
:
if
int
(
now
.
strftime
(
"
%
Y
%
m
%
d
%
H
%
M
%
S"
))
-
int
(
time
.
strftime
(
"
%
Y
%
m
%
d
%
H
%
M
%
S"
))
>
operation_timer
:
if
os
.
path
.
exists
(
folder
):
os
.
system
(
"rm -r "
+
folder
)
os
.
system
(
"rm -r "
+
folder
)
threading
.
Timer
(
clean_timer
,
clean
)
.
start
()
threading
.
Timer
(
clean_timer
,
clean
)
.
start
()
...
@@ -140,8 +144,7 @@ if __name__ == "__main__":
...
@@ -140,8 +144,7 @@ if __name__ == "__main__":
attempt
()
attempt
()
# Demonio clean
# Demonio clean
clean
()
clean
()
# Borro y creo msg/ por limpieza
# creo msg/ si no existe
if
os
.
path
.
exists
(
msgfolder
):
if
not
os
.
path
.
exists
(
msgfolder
):
os
.
system
(
"rm -r "
+
msgfolder
)
os
.
mkdir
(
msgfolder
)
os
.
mkdir
(
msgfolder
)
app
.
run
(
"0.0.0.0"
)
app
.
run
(
"0.0.0.0"
)
\ No newline at end of file
\ No newline at end of file
process.py
View file @
aa0e252
...
@@ -112,3 +112,6 @@ class Process:
...
@@ -112,3 +112,6 @@ class Process:
for
row
in
rows
:
for
row
in
rows
:
paths
.
append
(
row
[
0
])
paths
.
append
(
row
[
0
])
return
paths
return
paths
def
deletepath
(
self
,
path
):
self
.
conn
.
query
(
"DELETE FROM msg WHERE path = ?"
,(
path
,))
\ No newline at end of file
\ No newline at end of file
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