emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/detached 6548044d08 1/3: Determine the correct end time


From: ELPA Syncer
Subject: [elpa] externals/detached 6548044d08 1/3: Determine the correct end time for a session
Date: Fri, 14 Oct 2022 10:57:32 -0400 (EDT)

branch: externals/detached
commit 6548044d080297f2f94f44714cb490be7a8befb5
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>

    Determine the correct end time for a session
    
    When a state transition is called due to an event in the session
    directory, the end time can be set to current time.
    
    If the transition is called from initialization we need to approximate
    the end time using the session's log file.
---
 detached.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/detached.el b/detached.el
index d1828972c7..b18195890f 100644
--- a/detached.el
+++ b/detached.el
@@ -1370,13 +1370,14 @@ Optionally make the path LOCAL to host."
     ('attach "-a")
     (_ (error "`detached-session-mode' has an unknown value"))))
 
-(defun detached--session-state-transition-update (session)
-  "Update SESSION due to state transition."
-  ;; Update session
+(defun detached--session-state-transition-update (session &optional 
approximate)
+  "Update SESSION due to state transition.
+
+Optionally specify if the end-time should be APPROXIMATE or not."
   (let ((session-size (file-attribute-size
                        (file-attributes
                         (detached--session-file session 'log))))
-        (session-time (detached--update-session-time session) )
+        (session-time (detached--update-session-time session approximate))
         (status-fun (or (plist-get (detached--session-action session) :status)
                         #'detached-session-exit-code-status)))
     (setf (detached--session-size session) session-size)
@@ -1547,7 +1548,7 @@ session and trigger a state transition."
 
   (if (detached--active-session-p session)
       (if (detached--state-transition-p session)
-          (detached--session-state-transition-update session)
+          (detached--session-state-transition-update session 'approximate)
         (detached--db-update-entry session)
         (detached--watch-session-directory (detached--session-directory 
session)))
     (if (detached--session-missing-p session)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]