-
Notifications
You must be signed in to change notification settings - Fork 0
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
Use updated barcode to patron_id query #33
Conversation
logger.info(f"Setting Sierra query timeout to {sierra_timeout} minutes") | ||
sierra_client.execute_query(f"SET statement_timeout='{sierra_timeout}min';") | ||
logger.info("Querying Sierra for patron information by barcode") | ||
|
||
initial_log_level = logging.getLogger("postgresql_client").getEffectiveLevel() | ||
logging.getLogger("postgresql_client").setLevel(logging.CRITICAL) | ||
finished = False | ||
num_attempts = 1 | ||
while not finished: | ||
try: | ||
sierra_raw_data = sierra_client.execute_query(sierra_query) | ||
finished = True | ||
except PostgreSQLClientError as e: | ||
if num_attempts < max_sierra_attempts: | ||
logger.info("Query failed -- trying again") | ||
num_attempts += 1 | ||
else: | ||
logger.error( | ||
f"Error executing Sierra query {sierra_query}:" "\n{e}" | ||
) | ||
sierra_client.close_connection() | ||
s3_client.close() | ||
kinesis_client.close() | ||
raise e from None | ||
logging.getLogger("postgresql_client").setLevel(initial_log_level) | ||
|
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.
Just for my own understanding -- you're getting rid of this because of this story right? Just want to double check
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.
No it's part of this one. The reason we were originally retrying is because the query would time out and fail a bunch. With this new query we don't expect that to happen.
@@ -6,13 +6,11 @@ PLAINTEXT_VARIABLES: | |||
SIERRA_DB_PORT: 1032 | |||
SIERRA_DB_NAME: iii | |||
REDSHIFT_DB_NAME: production | |||
ENVISIONWARE_BATCH_SIZE: 500 | |||
ENVISIONWARE_BATCH_SIZE: 10000 |
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.
Last question -- any specific reason this was upped? Or is it just to improve performance?
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.
Now that the query is more efficient we can send more barcodes at once!
No description provided.