Azure / Azure/azure-functions-host
Make warmup behavior idempotent
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
#### What problem would the feature you're requesting solve? Please describe.
Currently [ScriptRouteHandler returns `Task.CompletedTask` on second, third etc. calls to `admin/warmup`](https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Routing/ScriptRouteHandler.cs#L52), creating the following sequence:
1. Call A to `/admin/warmup`
2. Warmup trigger function begins executing
3. Call B to `/admin/warmup`
4. Call B returns 200 OK
5. Call C to `admin/warmup`
6. Call C returns 200 OK
7. Warmup trigger function finished executing
8. Call A returns 200 OK
Calls B and C are false positives indicating warmup has completed. If the calling client pays attention to these responses, it may take action that should wait until warmup is complete while warmup is still in progress.
#### Describe the solution you'd like
By caching the task, or assigning the call to a task and returning the same task when the `_iswarmup` check is performed, this function will become idempotent. In the example above, calls A, B, and C would all wait on the same task with this approach.
Contributor guide
Research direction
Start in src/WebJobs.Script.WebHost/Routing/ScriptRouteHandler.cs around line 52 and trace the /admin/warmup handling and _iswarmup check. Confirm that concurrent calls share the warmup task and that every response waits until the warmup trigger function finishes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- api, backend, cloud
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100