10 Long-running operations
This chapter covers...
- TODO!
In most cases, incoming requests can be processed quickly, generating a response within a few hundred milliseconds after the request is received. In the cases where responses may take significantly longer, the default behavior of using the same API structure and asking users to "just wait longer" is not a very elegant option. In this chapter, we'll explore how to use long-running operations as a way of allowing API methods to behave in an asynchronous manner and ensuring that the slower API methods (including standard methods we saw in Chapter 8) can provide quick and consistent feedback while executing the actual work in the background.
10.1 Motivation
So far, all of the API methods we've explored have always been immediate and synchronous. The service receives a request, does some work right away, and sends back a response. And this particular manner of behavior is actually hard-coded into the API design as the return type is the result, not some promise to return a result later on down the line.