Skip to content

Commit

Permalink
Retry if telegram-cli returns non-array chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
mildsunrise committed Feb 6, 2017
1 parent d02a67b commit ec7bb95
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion telegram-history-dump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ def dump_dialog(dialog)
msg_chunk = exec_tg_command('history', dialog['print_name'],
$config['chunk_size'], cur_offset)
end
break
if msg_chunk.is_a?(Array)
break
end
$log.error('telegram-cli returned a non array chunk, retrying... (%d/%d)' % [
retry_count += 1, $config['chunk_retry']
])
rescue Timeout::Error
$log.error('Timeout, retrying... (%d/%d)' % [
retry_count += 1, $config['chunk_retry']
Expand Down

0 comments on commit ec7bb95

Please sign in to comment.