Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async events processing #78

Closed
janisz opened this issue Apr 20, 2016 · 0 comments
Closed

Async events processing #78

janisz opened this issue Apr 20, 2016 · 0 comments
Assignees
Labels

Comments

@janisz
Copy link
Contributor

janisz commented Apr 20, 2016

HttpEventActor try to be smart and if specific subscriber is not responding then rate to this subscriber is limited.

When consul is not responding (e.g., there is no leader, hos is unreachable, timeout occurs) we pass this error to Marathon returning 500. In the end rate to marathon-consul is limited and no events are sent hence service is not de/registered.

E.g.:

echo '{
          "slaveId":"85e59460-a99e-4f16-b91f-145e0ea595bd-S0",
          "taskId":"web",
          "taskStatus":"TASK_LOST",
          "message":"Command terminated with signal Terminated",
          "appId":"/test/app",
          "host":"localhost",
          "ports":[
            31372
          ],
          "version":"2015-12-07T09:02:48.981Z",
          "eventType":"status_update_event",
          "timestamp":"2015-12-07T09:33:40.898Z"
}' |  \
  http POST http://localhost:4000/events \
  cache-control:no-cache \
  content-type:application/json \
HTTP/1.1 500 Internal Server Error
Content-Length: 115
Content-Type: text/plain; charset=utf-8
Date: Wed, 20 Apr 2016 12:20:01 GMT

Put http://127.0.0.1:8500/v1/agent/service/deregister/web: net/http: request canceled (Client.Timeout exceeded while awaiting headers)

To solve this issue we should return 202 Accepted and process events asynchronous. As a first step we could change 500/400 responses to 200, but it will not prevent rate limit on consul timeout.
Changes are required in handler. Remember to check metrics and error handling.

@janisz janisz added the bug label Apr 20, 2016
@janisz janisz self-assigned this Apr 20, 2016
janisz added a commit that referenced this issue Apr 21, 2016
janisz added a commit that referenced this issue Apr 22, 2016
From now all events will be processed in background.
500 and 400 response codes should not appear for end
user. Instead they will get 202 Accepted.
janisz added a commit that referenced this issue Apr 22, 2016
janisz added a commit that referenced this issue Apr 22, 2016
From now all events will be processed in background.
500 and 400 response codes should not appear for end
user. Instead they will get 202 Accepted.
janisz added a commit that referenced this issue Apr 25, 2016
@janisz janisz closed this as completed in fb761a0 Apr 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant