fetching all those lines. Limiting the number of log lines retrieved helped resolve this issue. Using limit size of 2000.
I was able to see log when I limited to 10000 log lines as well, but it took much longer wait time and I felt a quicker
response might provide a better user experience and hence using 2000 log lines as the limit. Thus the most recent 2000
log lines are fetched, followed by newer log lines from event log if the job is still running.
results = []
log_history = Log.where(event_type: 'stderr',
- object_uuid: job_uuids).order('id DESC')
+ object_uuid: job_uuids).limit(2000).order('id DESC')
if !log_history.results.empty?
reversed_results = log_history.results.reverse
reversed_results.each do |entry|