Currently, the request state is being capured for each request that comes through on an endpoint. This state is currently saved regardless of the request status.
This means that if a request fails for any reason, eg a 400 Bad Request at an external lookup, or a 500 internal server error, the state for this failure is seen as the last captured state which will be used on a subsequent request.
This presents an issue when using the internal timestamp states captured because if you make use of this timestamp as a since parameter, it will not be accurate in terms of when the previous request was actually completed.
Request 1 (2020-04-25T10:00:000Z) - No State - extract parameter => _since=
Request 2 (2020-04-26T10:00:000Z) - No State - extract parameter => _since=2020-04-25T10:00:000Z
Request 3 (2020-04-27T10:00:000Z) FAILED - No State - extract parameter => _since=2020-04-26T10:00:000Z
Request 4 (2020-04-28T10:00:000Z) - No State - extract parameter => _since=2020-04-27T10:00:000Z
Request 4 should have a _since parameter of 2020-04-26T10:00:000Z because the request on the 27th was not successful
Fix
Update the states model to also capture the request statusCode. This statusCode will then be used in the states lookup request to find the last successful state that was triggered.
Currently, the request state is being capured for each request that comes through on an endpoint. This state is currently saved regardless of the request status.
This means that if a request fails for any reason, eg a 400 Bad Request at an external lookup, or a 500 internal server error, the state for this failure is seen as the last captured state which will be used on a subsequent request.
This presents an issue when using the internal timestamp states captured because if you make use of this timestamp as a
since
parameter, it will not be accurate in terms of when the previous request was actually completed.Request 1 (2020-04-25T10:00:000Z) - No State - extract parameter =>
_since=
Request 2 (2020-04-26T10:00:000Z) - No State - extract parameter =>_since=2020-04-25T10:00:000Z
Request 3 (2020-04-27T10:00:000Z) FAILED - No State - extract parameter =>_since=2020-04-26T10:00:000Z
Request 4 (2020-04-28T10:00:000Z) - No State - extract parameter =>_since=2020-04-27T10:00:000Z
Request 4 should have a
_since
parameter of 2020-04-26T10:00:000Z because the request on the 27th was not successfulFix
Update the states model to also capture the request statusCode. This statusCode will then be used in the states lookup request to find the last successful state that was triggered.