Skip to content

Commit

Permalink
Fix for Onedrive listener (#130)
Browse files Browse the repository at this point in the history
* onedrive listener update

* fixed spacing error

* Fixed onedrive listener errors from python conversion

* Upped timer for stale checks for onedrive listener

* Removed print statements
  • Loading branch information
Cx01N authored Mar 21, 2020
1 parent a867674 commit 6d53f56
Show file tree
Hide file tree
Showing 3 changed files with 225 additions and 173 deletions.
1 change: 0 additions & 1 deletion lib/common/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,6 @@ def handle_agent_staging(self, sessionID, language, meta, additional, encData, s
'message': message
})
dispatcher.send(signal, sender="agents/{}".format(sessionID))

nonce = helpers.random_string(16, charset=string.digits)
delay = listenerOptions['DefaultDelay']['Value']
jitter = listenerOptions['DefaultJitter']['Value']
Expand Down
11 changes: 9 additions & 2 deletions lib/common/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,9 +758,16 @@ def lastseen(stamp, delay, jitter):
"""
try:
delta = datetime.now() - datetime.strptime(stamp, "%Y-%m-%d %H:%M:%S")
if delta.seconds > delay * (jitter + 1) * 5:

# Set min threshold for delay/jitter
if delay < 1:
delay = 1
if jitter < 1:
jitter = 1

if delta.seconds > delay * (jitter + 1) * 7:
return color(stamp, "red")
elif delta.seconds > delay * (jitter + 1):
elif delta.seconds > delay * (jitter + 1) * 3:
return color(stamp, "yellow")
else:
return color(stamp, "green")
Expand Down
Loading

0 comments on commit 6d53f56

Please sign in to comment.