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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
deploy.py
process.py
deploy.py
View file @
aa0e252
...
...
@@ -123,11 +123,15 @@ def clean():
now
=
datetime
.
datetime
.
now
()
for
folder
in
paths
:
# carpeta no existe, borrar mensaje
if
not
os
.
path
.
exists
(
folder
):
p
.
deletepath
(
folder
)
continue
mtime
=
os
.
path
.
getmtime
(
folder
)
# 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
os
.
path
.
exists
(
folder
):
os
.
system
(
"rm -r "
+
folder
)
os
.
system
(
"rm -r "
+
folder
)
threading
.
Timer
(
clean_timer
,
clean
)
.
start
()
...
...
@@ -140,8 +144,7 @@ if __name__ == "__main__":
attempt
()
# Demonio clean
clean
()
# Borro y creo msg/ por limpieza
if
os
.
path
.
exists
(
msgfolder
):
os
.
system
(
"rm -r "
+
msgfolder
)
os
.
mkdir
(
msgfolder
)
# creo msg/ si no existe
if
not
os
.
path
.
exists
(
msgfolder
):
os
.
mkdir
(
msgfolder
)
app
.
run
(
"0.0.0.0"
)
\ No newline at end of file
process.py
View file @
aa0e252
...
...
@@ -111,4 +111,7 @@ class Process:
paths
=
[]
for
row
in
rows
:
paths
.
append
(
row
[
0
])
return
paths
\ No newline at end of file
return
paths
def
deletepath
(
self
,
path
):
self
.
conn
.
query
(
"DELETE FROM msg WHERE path = ?"
,(
path
,))
\ 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