259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
# File 'lib/matrix_sdk/client.rb', line 259
def sync(skip_store_batch: false, **params)
= {
filter: sync_filter,
timeout: 30
}
[:since] = @next_batch unless @next_batch.nil?
.merge!(params)
[:filter] = [:filter].to_json unless [:filter].is_a? String
attempts = 0
data = loop do
begin
break api.sync
rescue MatrixSdk::MatrixTimeoutError => e
raise e if (attempts += 1) >= params.fetch(:allow_sync_retry, 0)
end
end
@next_batch = data[:next_batch] unless skip_store_batch
handle_sync_response(data)
end
|