enum td_source_state state;
int r;
+ // Ignore some return codes
+ switch (-result) {
+ // If the heartbeat callback has launched an asynchronous task (e.g. executing
+ // a command or sending a HTTP request), we will expect this to be signalled
+ // and won't log any errors right now.
+ case EINPROGRESS:
+ return 0;
+
+ default:
+ break;
+ }
+
// Move everything up in the array
for (unsigned int i = NUM_RESULTS - 1; i > 0; i--)
self->results.r[i] = self->results.r[i - 1];
// Call the heartbeat method
r = self->impl->heartbeat(self->ctx, self);
if (r < 0) {
- ERROR(self->ctx, "heartbeat() failed for %s: %s\n",
- td_source_name(self), strerror(-r));
+ switch (-r) {
+ case EINPROGRESS:
+ break;
+
+ default:
+ ERROR(self->ctx, "heartbeat() failed for %s: %s\n",
+ td_source_name(self), strerror(-r));
+ break;
+ }
}
// Fetch the end timestamp