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

[core-util] Update "delay" method in core-util with abort options #23019

Merged
29 commits merged into from
Sep 9, 2022

Conversation

minhanh-phan
Copy link
Member

@minhanh-phan minhanh-phan commented Aug 26, 2022

Packages impacted by this PR

core-util

Issues associated with this PR

#15930

Describe the problem that is addressed by this PR

  • Update "delay" in core-util to support abort message
  • Unduplicate "delay" function in core-http and core-amqp

What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?

  • Choose the implementation with "options" parameters to keep the flexibility in case we want to add extra functionality in the future

Are there test cases added in this PR? (If not, why?)

Provide a list of related PRs (if any)

#15832

Command used to generate this PR:**(Applicable only to SDK release request PRs)

Checklists

  • [x ] Added impacted package name to the issue description
  • Does this PR needs any fixes in the SDK Generator?** (If so, create an Issue in the Autorest/typescript repository and link it here)
  • Added a changelog (if necessary)

@ghost ghost added the Azure.Core label Aug 26, 2022
@minhanh-phan minhanh-phan marked this pull request as draft August 26, 2022 17:24
@ghost
Copy link

ghost commented Aug 26, 2022

CLA assistant check
All CLA requirements met.

@azure-sdk
Copy link
Collaborator

azure-sdk commented Aug 30, 2022

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-core-amqp
azure-core-http
azure-core-util

@minhanh-phan minhanh-phan marked this pull request as ready for review August 31, 2022 21:19
Comment on lines 15 to 21
// Warning: (ae-forgotten-export) The symbol "DelayOptions" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export function delay<T>(timeInMs: number, options?: DelayOptions): Promise<T | void>;

// @public (undocumented)
export function delay<T>(timeInMs: number, value: T, options?: DelayOptions): Promise<T | void>;
Copy link
Member

Choose a reason for hiding this comment

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

Why do we have two?

Copy link
Member Author

@minhanh-phan minhanh-phan Sep 1, 2022

Choose a reason for hiding this comment

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

Many calls for the delay method have the value parameter set to undefined. We want to overload the method so that the users do not have to pass in undefined

Copy link
Member

Choose a reason for hiding this comment

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

I looked into this with @minhanh-phan offline, and it looks like the overload with value is not really used anywhere, so just keeping a single signature with no value: T

Constants.defaultOperationTimeoutInMs * 1.5,
undefined,
undefined,
"ondetachednevercalled"
Copy link
Member

Choose a reason for hiding this comment

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

looks like the test did not get translated fully?
"ondetachednevercalled" is missing in the update.

Copy link
Member Author

Choose a reason for hiding this comment

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

We do not have 'abortSignal' passed in, so the message will not actually be used regardless

Copy link
Member

Choose a reason for hiding this comment

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

Yeah if the abort controller is not passed (test was passing undefined), then the abort error is never going to be thrown, so it makes sense to remove it.

Copy link
Member

Choose a reason for hiding this comment

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

image
Looking deeper, it's not the error message, it's the 4th arg, value.

So, we should retain it for the proper expectation of the test.

Copy link
Member Author

Choose a reason for hiding this comment

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

The delay function description looks odd because the value parameter has been deleted and it should not be of string type regardless. I'll look into it.

sdk/core/core-amqp/src/util/utils.ts Outdated Show resolved Hide resolved
sdk/core/core-util/package.json Outdated Show resolved Hide resolved
sdk/core/core-util/review/core-util.api.md Outdated Show resolved Hide resolved
@@ -5,6 +5,7 @@
### Features Added

- Add helper type guards `isDefined`, `isObjectWithProperties`, `objectHasProperty`.
- Update `delay` method to handle `abortSignal` functionality
Copy link
Member

Choose a reason for hiding this comment

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

I merged a PR yesterday to bump core-util version to 1.1.0. This PR should probably wait until after we release core-util today.

Copy link
Member

@HarshaNalluru HarshaNalluru left a comment

Choose a reason for hiding this comment

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

Concerned about the service-bus test changes

@check-enforcer
Copy link

check-enforcer bot commented Sep 2, 2022

This pull request is protected by Check Enforcer.

What is Check Enforcer?

Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass.

Why am I getting this message?

You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged.

What should I do now?

If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows:
/check-enforcer evaluate
Typically evaulation only takes a few seconds. If you know that your pull request is not covered by a pipeline and this is expected you can override Check Enforcer using the following command:
/check-enforcer override
Note that using the override command triggers alerts so that follow-up investigations can occur (PRs still need to be approved as normal).

What if I am onboarding a new service?

Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment:
/azp run prepare-pipelines
This will run a pipeline that analyzes the source tree and creates the pipelines necessary to build and validate your pull request. Once the pipeline has been created you can trigger the pipeline using the following comment:
/azp run js - [service] - ci

@@ -368,7 +368,7 @@ export function createSasTokenProvider(data: {
// @public
export const defaultCancellableLock: CancellableAsyncLock;

// @public
// @public @deprecated
Copy link
Member

Choose a reason for hiding this comment

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

Need not be deprecated anymore, right?

Because this supports the value argument and the core-utils one doesn't.

Copy link
Member

@HarshaNalluru HarshaNalluru left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Member

@xirzec xirzec left a comment

Choose a reason for hiding this comment

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

One minor nit but wow!! Looks great

sdk/core/core-util/src/delay.ts Outdated Show resolved Hide resolved
Co-authored-by: Jeff Fisher <xirzec@xirzec.com>
@ghost
Copy link

ghost commented Sep 8, 2022

Hello @minhanh-phan!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit a6e366d into Azure:main Sep 9, 2022
@minhanh-phan minhanh-phan deleted the delay-fix branch March 15, 2023 21:50
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-js that referenced this pull request Apr 18, 2023
Feature/cplat 2023 03 01 (Azure#22885)

* copy last version to 2023-03-01 folder

* update version reference in the new folder

* update versions reference in the new folder

* add new readme tag with new version

* sync with updates made to 2022-11-01 version

* fix generation error

* fix duplicate enum name thru c# directive instead.

* make all the changes to this version that was made to the last version (2022-11-01) to address modelvalidation errors

* update

* Revert "update"

This reverts commit 08417d3ed412ab63c7ee7bdb712ad756ded03c97.

* Added $expand option in ListAllVMs and ListAllVMs in RG (Azure#22800)

* Added $expand option in ListAllVMs and ListAllVMs in RG

* Update virtualMachine.json

* dedicatedHost Resize feature (Azure#23268)

* dedicatedHost Resize feature

* DedicatedHost Sku renamed to size and resolved lint errors.

* reviewer comments

* httpMethod fix

* Add property for VM (Azure#22882) (Azure#23329)

Co-authored-by: payalguptapg <126145083+payalguptapg@users.noreply.github.com>

* Add Reapply for VMSS (Azure#22344)

* Add Reapply for VMSS

* Prettier fix

* Update examples

* Address review comments 01

* Use typical resourceGroupName parameter.

* Address review comments - Rename examples

* Remove <br> syntax from many descriptions in CRP swagger files (Azure#23019)

* up to computeRPCommon

* all but computeRPCommons

* computerpcommon

* vmss clean

* common clean

* vmss try n

* trying only \n

* remove \n as it messes with rest docs

* cleanup 2022-11-01 accidents

* cleanups 2023

* remove ID from Update objects that do not have ID (Azure#23078)

* update

* add identifiers

---------

Co-authored-by: Theodore Chang <theodore.l.chang@gmail.com>

* Origin/feature/cplat 2023 03 01 (Azure#23203)

* Update virtualMachine.json

Added missing property for 
Additional properties not allowed: provisionAfterExtensions
Json path: $.value[*].properties.provisionAfterExtensions

* added missing property for provisionAfterExtensions

* add locatoin in VirtualMachineScaleSetVMExtension

* fixed issue of x-ms-mutability

---------

Co-authored-by: Younghyun Kim <younghyunkim@microsoft.com>

* Add securityPostureReference (Azure#23106)

* [RestorePoints] Adding Encryption, Source Details, HyperVGeneration and WriteAccelerated for Restore Point (Azure#23303)

* Restore Point Encryption Details

* Modified descriptions and made DiskRestorePointProperties as input property

* Renaming object and adding type

* Renaming DiskRestorePointProperties

* making DiskRestorePoint.id readOnly

* Modifying reference

* Running Prettier

* Renaming EncryptionType

* Adding HyperVGeneration and WriteAcceleratorEnabled (prchin)

* Add optional parameter hibernate to vmss deallocate api (Azure#23409)

* Add optional parameter hibernate to vmss deallocate api

* Fix with prettier

* update example for vmss deallocate

* Add Spot Related Properties to VMSS PATCH

* prettier and lintDiff suppressions

* retry lintDiff suppression

* lint diff suppression retry

* Add managed identities parameters for blobs, add treatFailureAsDeploymentFailure flag for Run Command (Azure#23557)

* Add managed identities inputs for script, errorBlob, outputBlob

* Add treatFailureAsDeploymentFailure flag

* Update proximityPlacementGroup.json (Azure#23556)

* Update proximityPlacementGroup.json

* Update proximityPlacementGroup.json

* Update proximityPlacementGroup.json

---------

Co-authored-by: Theodore Chang <theodore.l.chang@gmail.com>
Co-authored-by: Kartik Gupta <31189137+Kartik-715@users.noreply.github.com>
Co-authored-by: cakarata <47228825+cakarata@users.noreply.github.com>
Co-authored-by: payalguptapg <126145083+payalguptapg@users.noreply.github.com>
Co-authored-by: Anshul Verma <88476874+AnshulVermaa@users.noreply.github.com>
Co-authored-by: Adam Sandor <adsandor@microsoft.com>
Co-authored-by: younghyun5756 <102988755+younghyun5756@users.noreply.github.com>
Co-authored-by: Younghyun Kim <younghyunkim@microsoft.com>
Co-authored-by: krishnak-msft <127885427+krishnak-msft@users.noreply.github.com>
Co-authored-by: Linu George <127192938+linugeorgeofficial@users.noreply.github.com>
Co-authored-by: vatsan28 <vatsan9228@gmail.com>
Co-authored-by: Viv Lingaiah <viv.lingaiah@gmail.com>
Co-authored-by: Micah McKittrick <32313503+mimckitt@users.noreply.github.com>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants