eo_mailbox: skip mailboxes that didn't change for a long time (#50374)
This commit is contained in:
parent
a780b2b6d0
commit
ed3eae6c2c
|
@ -132,11 +132,16 @@ def mailboxes(ctn):
|
|||
# mailboxes there.
|
||||
return
|
||||
boxes = glob.glob("/var/spool/mail/*")
|
||||
days_ago = time.time() - 30 * 86400
|
||||
for m in boxes:
|
||||
if os.path.isfile(m):
|
||||
n = m.split("/")[-1]
|
||||
c = len(mailbox.mbox(m))
|
||||
eo_mailboxes.labels(ctn, n).set(c)
|
||||
if not os.path.isfile(m):
|
||||
continue
|
||||
if not os.stat(m).st_mtime > days_ago:
|
||||
# skip mailboxes that didn't change for a long time
|
||||
continue
|
||||
n = m.split("/")[-1]
|
||||
c = len(mailbox.mbox(m))
|
||||
eo_mailboxes.labels(ctn, n).set(c)
|
||||
|
||||
|
||||
def postgresql(ctn):
|
||||
|
|
Loading…
Reference in New Issue