|
|
@@ -82,9 +82,12 @@ class SenslogV1Pusher implements ConnectorPusher<SenslogV1Model> {
|
|
|
observationQueue.addAll(failedObservations);
|
|
|
failedObservations.clear();
|
|
|
|
|
|
- for (int counter = 1; counter < observationQueue.size() + 1; counter++) {
|
|
|
+ int counter = 0;
|
|
|
+ while (!observationQueue.isEmpty()) {
|
|
|
Observation observation = observationQueue.remove();
|
|
|
+
|
|
|
String id = UUID.randomUUID().toString();
|
|
|
+ counter += 1;
|
|
|
|
|
|
logger.debug("Creating a request for the observation {}.", id);
|
|
|
logger.info("Observation {} {}", id, observation);
|
|
|
@@ -110,7 +113,8 @@ class SenslogV1Pusher implements ConnectorPusher<SenslogV1Model> {
|
|
|
if (response.isError()) {
|
|
|
logger.error("Observation {} was not send. Reason {}.", id, response.getBody());
|
|
|
|
|
|
- if (counter <= ALLOWED_REQUEST_FAILS) {
|
|
|
+
|
|
|
+ if (counter < ALLOWED_REQUEST_FAILS) {
|
|
|
failedObservations.add(observation);
|
|
|
continue;
|
|
|
} else {
|