-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Adding upload file and poll operation with sample and test #31928
Adding upload file and poll operation with sample and test #31928
Conversation
await new Promise(resolve => setTimeout(resolve, sleepInterval)); | ||
const updatedResult = await context.path(`/files/${result.body.id}`, result.body.id).get(options); | ||
result.body = updatedResult.body; | ||
} |
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.
Provide a way to stop polling.
@@ -31,6 +31,19 @@ export async function uploadFile( | |||
return result.body; | |||
} | |||
|
|||
/** Uploads a file for use by other operations. */ | |||
export async function uploadFileAndPoll( |
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.
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.
@ganeshyb would we want to use an LRO here?
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 am not sure actually, could you help me understand what the traffic will look like?
We leverage the first request to upload the file successfully but when this request is back this doesn't mean the server side is completed. So we have following requests to poll status? Will this be the traffic?
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, The scenarios is first the user uploads the file, based on the file size and processing on the backend, its goes through states like pending, running, This api waits for the file to be uploaded and wait till its processed.
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.
Interesting, this seems to be an LRO operation for me and it would be a case like multipart/form-data + LRO. I have two questions here:
- Does this operation follow our LRO guideline?
- Have we reviewed with this with our architects? Why the spec is a still normal operation?
…e-sdk-for-js into zacharyking/updateFilePoll
…e-sdk-for-js into zacharyking/updateFilePoll
…e-sdk-for-js into zacharyking/updateFilePoll
…K/azure-sdk-for-js into zacharyking/updateFilePoll
@@ -7,7 +7,7 @@ import { AbortSignalLike } from "@azure/abort-controller"; | |||
import { PollingOptions } from "./customModels.js"; | |||
|
|||
interface PollResult { | |||
status: string; | |||
status?: string; |
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.
curious why this is optional ?
} else { | ||
file = await getFile(context, currentResult.id, options); | ||
} | ||
return { result: file, completed: file.status !== "pending" && file.status !== "running" }; |
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.
Could we check terminal states ?
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.
Changed to check terminal states
@@ -31,6 +31,19 @@ export async function uploadFile( | |||
return result.body; | |||
} | |||
|
|||
/** Uploads a file for use by other operations. */ | |||
export async function uploadFileAndPoll( |
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, The scenarios is first the user uploads the file, based on the file size and processing on the backend, its goes through states like pending, running, This api waits for the file to be uploaded and wait till its processed.
No description provided.