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
perform credentials check before creating consumer #256
Conversation
there are two changes here:
|
provider/service.py
Outdated
@@ -106,7 +113,7 @@ def run(self): | |||
# running trigger should become disabled | |||
# this should be done regardless of which worker the document claims to be assigned to | |||
logging.info('[{}] Existing running trigger should become disabled'.format(change["id"])) | |||
existingConsumer.disable() | |||
existingConsumer.shutdown() |
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.
Need to update doc above that mentions that the consumer should be disabled.
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.
good catch
provider/service.py
Outdated
if doc['isMessageHub']: | ||
retries = 0 | ||
max_retries = 5 | ||
url = '{}/admin/topics'.format(doc['kafka_admin_url']) |
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.
Will the admin URL throttle requests?
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.
haven't experienced throttling in my own testing, but i will have to double check on the official answer
consumer.start() | ||
else: | ||
logging.info('[{}] Trigger was determined to be disabled, not starting...'.format(triggerFQN)) | ||
logging.info('[{}] Starting consumer...'.format(triggerFQN)) |
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.
Do these changes affect the other occurrence of the call to __isTriggerDocActive
in this file?
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.
yes. currently we detect a change in the changes feed and check whether that consumer is in our in-memory cache. this is still the case, however, since we will not be creating disabled consumers. the only time we'll hit the code path where we are going from inactive -> active and
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.
we do have that consumer in memory is when we disable a trigger for reasons like client errors. doing that is something that may likely change in the future. so that whole logic would need reworking
password = doc['password'] | ||
topic = doc['topic'] | ||
|
||
while retries < max_retries: |
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.
Seems like we could have a test here for invalid auth.
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.
yeah i'm afraid i'm going to have to change a doc in cloudant for that. need to get that figured out
provider/service.py
Outdated
logging.info('Received status code {} for {} while validating authKey. Retrying in {} second(s)'.format(status_code, triggerFQN, sleepyTime)) | ||
time.sleep(sleepyTime) | ||
retries += 1 | ||
|
||
# Create a representation for this trigger, even if it is disabled |
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.
i need to update this comment as well
… and shutting down vs disabling
Closing as abandoned |
No description provided.