-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API_PARSER][PROOFPOINT TRAP] Add timeout choice #487
base: dev
Are you sure you want to change the base?
Conversation
@@ -56,6 +56,7 @@ def __init__(self, data): | |||
self.proofpoint_trap_host = "https://" + self.proofpoint_trap_host | |||
|
|||
self.proofpoint_trap_apikey = data["proofpoint_trap_apikey"] | |||
self.proofpoint_trap_timeout = int(data.get("proofpoint_trap_timeout", 20)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small detail, here the .get()
is confusional, as your Django parameter had a already a default value, in order to check that GUI parameter works as expected, please don't default this value here
@@ -94,7 +95,7 @@ def __execute_query(self, url, query=None, timeout=20): | |||
logger.info(f"[{__parser__}]:execute: API Rate limit exceeded, waiting 10 seconds...", | |||
extra={'frontend': str(self.frontend)}) | |||
time.sleep(10) | |||
return self.__execute_query(url, query, timeout) | |||
return self.__execute_query(url, query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmmmh this recursive call makes me anxious, we don't need it at all, could you please do it iteratively using a while for example ?
Please ensure to execute a self.update_lock()
whenever you are entering the loop, to avoid multiple simultaneous executions, moreover you needs to set the following condition not self.event_stop.is_set()
in your loop to avoid infinite loop blocking service shutdown/updates
89a1f18
to
b365277
Compare
406ca9d
to
65e54ab
Compare
@@ -1172,6 +1172,11 @@ class Frontend(models.Model): | |||
help_text = _("ProofPoint TRAP API key"), | |||
default = "", | |||
) | |||
proofpoint_trap_timeout = models.PositiveIntegerField( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this parameter 'generic' for every API collector: this seems like a change that can be implemented for all of them (you don't necessarily need to implement it in very collector yet, though)
17f7fb0
to
3b9a04a
Compare
No description provided.