Skip to content
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

Upgrade Azure Storage SDK to a modern version #629

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

RomanIakovlev
Copy link
Contributor

This change is a prerequisite to enable token-based authentication for the Azure Storage operations (blobs and queues). This change leaves the options to use the existing, connection string-based authentication though.

Copy link
Collaborator

@elrayle elrayle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments. I know you plan to do more testing, so I'll take another look once that is done.

Comment on lines 105 to 106
const properties = await this.queueClient.getProperties()
return { count: properties.approximateMessagesCount }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This likely applies in other places as well. In the original code, error handling logged the error. In the new code, it appears that error handling depends on how await handles exceptions instead of using try and catch blocks to log the error in the same way as the original.

Suggested change
const properties = await this.queueClient.getProperties()
return { count: properties.approximateMessagesCount }
try {
const properties = await this.queueClient.getProperties()
return { count: properties.approximateMessagesCount }
} catch (error) {
this.logger.error(error) // Log the error
return null // Handle the error by returning null
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's a good point. There was one more place like this, I've updated it as well.

if (connectionString) {
this.client = QueueServiceClient.fromConnectionString(connectionString, pipelineOptions)
} else {
this.client = new QueueServiceClient(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice update here for maintaining the old approach and setting up a more flexible long term approach.

const retryOperations = new AzureStorage.ExponentialRetryPolicyFilter()
this.client = AzureStorage.createQueueService(connectionString).withFilter(retryOperations)
constructor(connectionString, options) {
const pipelineOptions = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the use of pipelineOptions. Makes it easier to see the configs related to the queues.

}

// This API can only be used for the 'deadletter' store because we cannot look up documents by type performantly
async count(type, force = false) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you talk about the reason this is deleted completely?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was an oversight, I've brought it back. Thanks for catching it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants