Race Conditions, Rate Limiting, and Error Handling race-conditions-and-error-handling
Describes how to prevent race conditions and DCS error handling.
Preventing Race Conditions prevent-race-conditions
A race condition can occur if you send multiple calls simultaneously (or in rapid succession) to the DCS before it finishes responding to the initial queries and writing data to the user’s cookie. A race condition is undesirable because it can corrupt or improperly overwrite cookie data. As a best practice, consider the following methods to help avoid this problem:
- Don’t make simultaneous calls, or calls in rapid succession, to the DCS from the same user.
- Wait for each response to come back before making subsequent calls.
Rate limiting rate-limiting
ÃÛ¶¹ÊÓƵ may introduce rate limiting if it detects excessive DCS API calls that could have a negative impact on service availability.
If rate limiting is enabled, you might receive a 429 Too Many Requests
HTTP response status code on your DCS calls. When receiving this HTTP response, please retry the API calls at a later time.
Error Handling error-handling
Error handling is limited for invalid or poorly formed queries. An invalid request returns an HTTP 200 OK
response and no data. Also, the DCS stops processing a request, discards trait data, and returns an HTTP 200 OK
response when a user:
- Opts out of tracking at the Audience Manager or partner level.
- Comes from an invalid/unselected geographic region.
- Disables browser cookies (either all or third-party).
See also, DCS Error Codes, Messages, and Examples.