Skip to content

Commit

Permalink
add cdate/mdate to happ
Browse files Browse the repository at this point in the history
  • Loading branch information
manatlan committed Jun 5, 2024
1 parent b68b8f1 commit 6f9b9af
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
".","-s"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
"python.testing.pytestEnabled": true,
"IDX.aI.enableInlineCompletion": true,
"IDX.aI.enableCodebaseIndexing": true
}
10 changes: 10 additions & 0 deletions htagweb/fifo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import json
import glob
import aiofiles
from datetime import datetime

class Fifo:
# FOLDER="./ses"
Expand All @@ -31,6 +32,15 @@ def __str__(self):
def exists(self) -> bool:
return os.path.exists(self.CLIENT_TO_SERVER_FIFO) and os.path.exists(self.SERVER_TO_CLIENT_FIFO)

def dates(self) -> tuple:
if self.exists():
stat = os.stat(self.CLIENT_TO_SERVER_FIFO)
cdate = datetime.fromtimestamp(stat.st_ctime)
mdate = datetime.fromtimestamp(stat.st_mtime)
return (cdate,mdate)
else:
return (None,None)

def createPipes(self): # for server
# Créer les named pipes
folder = os.path.dirname(self.CLIENT_TO_SERVER_FIFO)
Expand Down
1 change: 1 addition & 0 deletions htagweb/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
class HApp:
def __init__( self, uid:str,moduleapp:str,pid:int ):
self.fifo=Fifo(uid,moduleapp)
self.cdate,self.mdate = self.fifo.dates()
self.pid=pid

def kill(self):
Expand Down
2 changes: 2 additions & 0 deletions test_manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ async def test_manage():

assert ll[0].uid == "ut2"

assert ll[0].apps[0].cdate
assert ll[0].apps[0].mdate
ll[0].apps[0].kill()

assert manage.users() == []
Expand Down

0 comments on commit 6f9b9af

Please sign in to comment.