buffet: Serialize/queue device state updates to the cloud server

Make sure there are no simultaneous device state patche requests
sent to the GCD server. As long as one request is pending, postpone
all subsequent requests until the previous request finishes.

Since DoCloudRequest() performs all the necessary retries and transient
error handling, no additional error handling is required in
PublishStateUpdates() method.

BUG=brillo:1195
TEST=`FEATURES=test emerge-link buffet`
     `test_that -b link 100.96.49.59 e:buffet_.*`

Change-Id: Ia65f7c9f844580a01aaef89271373b8ca710ef19
Reviewed-on: https://chromium-review.googlesource.com/280861
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
2 files changed
tree: 1e83b45f282b12ae5ea1a02569215bf2c3fb93c8
  1. buffet/