Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
subcriptions: reschedule - add the early retry scheme for the busy si…
…tuations
  • Loading branch information
perexg committed Aug 17, 2014
1 parent 68232b6 commit adc5999
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/subscriptions.c
Expand Up @@ -296,6 +296,8 @@ subscription_reschedule(void)

if (!s->ths_channel)
s->ths_service = si->si_s;

s->ths_last_error = 0;
}

error = s->ths_testing_error;
Expand All @@ -313,6 +315,13 @@ subscription_reschedule(void)
s->ths_current_instance = si;

if(si == NULL) {
if (s->ths_last_error != error || s->ths_last_find + 2 >= dispatch_clock) {
tvhtrace("subscription", "instance not available, retrying");
if (s->ths_last_error != error)
s->ths_last_find = dispatch_clock;
s->ths_last_error = error;
continue;
}
/* No service available */
sm = streaming_msg_create_code(SMT_NOSTART, error);
streaming_target_deliver(s->ths_output, sm);
Expand Down
3 changes: 3 additions & 0 deletions src/subscriptions.h
Expand Up @@ -76,6 +76,9 @@ typedef struct th_subscription {

int ths_flags;

time_t ths_last_find;
int ths_last_error;

streaming_message_t *ths_start_message;

char *ths_hostname;
Expand Down

0 comments on commit adc5999

Please sign in to comment.