When the Magic 8 Ball Azure Function hasn't been used for a while (e.g. more than 12 hours), it takes more than 30 seconds to start up, so the 8 Ball just spins and then displays an error 500 response.
A behavioral improvement might be to have the AI page call the classic service asynchronously when it's first displayed, to start the wake-up process while the user is entering a question.
When the classic request completes, it can set a static flag indicating whether a successful response was received.
When the user actually clicks the eight ball and starts the AI request, if the completion flag has not yet been set, it could enable the display of a prompt indicating the AI service needs a moment to wake up.
If/when the AI request complete successfully, it should also set the flag as true.
If needed, a timer could be added to check again in 12 hours, in case the browser is left open that long.
The completion flag could have enumerated values such as unknown, checking, success, failure, and a date time stamp of the last known status.
When the Magic 8 Ball Azure Function hasn't been used for a while (e.g. more than 12 hours), it takes more than 30 seconds to start up, so the 8 Ball just spins and then displays an error 500 response. A behavioral improvement might be to have the AI page call the classic service asynchronously when it's first displayed, to start the wake-up process while the user is entering a question. When the classic request completes, it can set a static flag indicating whether a successful response was received. When the user actually clicks the eight ball and starts the AI request, if the completion flag has not yet been set, it could enable the display of a prompt indicating the AI service needs a moment to wake up. If/when the AI request complete successfully, it should also set the flag as true. If needed, a timer could be added to check again in 12 hours, in case the browser is left open that long. The completion flag could have enumerated values such as unknown, checking, success, failure, and a date time stamp of the last known status.