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

[Storage] RetryOptions members unnecessarily readonly #4717

Closed
2 tasks done
mjrousos opened this issue Aug 8, 2019 · 4 comments
Closed
2 tasks done

[Storage] RetryOptions members unnecessarily readonly #4717

mjrousos opened this issue Aug 8, 2019 · 4 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. feature-request This issue requires a new behavior in the product in order be resolved. Storage Storage Service (Queues, Blobs, Files)

Comments

@mjrousos
Copy link
Member

mjrousos commented Aug 8, 2019

  • Package Name: @azure/storage-blob
  • Package Version: 12.0.0-preview.2
  • Operating system: Windows
  • nodejs
    • version: 12.8.0
  • typescript
    • version: 3.5.3

Describe the bug
This is a minor issue, but there seems to be some inconsistency in the RetryOptions interface.

Its members are all readonly, but equivalent fields in the .NET SDK's RetryOptions type are not, nor are members of other 'options' objects used when setting up pipelines (like ProxyOptions or TelemetryOptions.

Expected behavior
I would have expected RetryOption's properties to be gettable and settable (beyond object creation-time) similar to other options interfaces.

@loarabia loarabia added Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files) labels Aug 8, 2019
@triage-new-issues triage-new-issues bot removed the triage label Aug 8, 2019
@XiaoningLiu
Copy link
Member

XiaoningLiu commented Sep 2, 2019

@mjrousos It's by desing to be readonly for options. Because underlayer code does't keep a reference to the original retry policy options. See

Is any usage scenario for this requirement?

@XiaoningLiu XiaoningLiu self-assigned this Sep 2, 2019
@XiaoningLiu XiaoningLiu added the feature-request This issue requires a new behavior in the product in order be resolved. label Sep 2, 2019
@mjrousos
Copy link
Member Author

mjrousos commented Sep 3, 2019

I see. Thanks for explaining, @XiaoningLiu. There's no scenario where this is required since there are simple work-arounds, I just had a use case where I created RetryOptions and wanted other code to have an opportunity to change them before creating the RetryPolicy. This can be done by creating new retry options but it seemed strange that that was necessary for RetryOptions and not for other types used to create a RetryPolicy. I see what you mean about the reference to the options object not being stored, though. It's probably fine to leave this code as it is.

@kurtzeborn kurtzeborn added customer-reported Issues that are reported by GitHub users external to the Azure organization. and removed customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Sep 13, 2019
@kurtzeborn
Copy link
Member

Closing as it looks like this discussion is complete. @mjrousos, please open a new issue if you have any further questions or find any other bugs in the preview. Thank you for trying it out!

@jeremymeng
Copy link
Member

Hi Mike @mjrousos let's embrace immutability using spread operator

> oldOption = { a: 1, b: 2 }
{ a: 1, b: 2 }
> newOptiono = { ...oldOption, b: 3 }
{ a: 1, b: 3 }

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. feature-request This issue requires a new behavior in the product in order be resolved. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

5 participants