Commit d769ea69 authored by Vasyl Bodnaruk's avatar Vasyl Bodnaruk

Add BufferIO for FileResponse

As a performance on staging server is bad - need try to use BufferIO for FileResponse
parent 325a7926
import io
from datetime import datetime, time
from django.shortcuts import render, HttpResponseRedirect, reverse, HttpResponse
from django.http import JsonResponse
from django.http import JsonResponse, FileResponse
from django.views.generic import ListView, CreateView, UpdateView
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
......@@ -54,8 +55,9 @@ class JobListView(ListView):
if action == 'restart':
return JsonResponse(self.service.restart_job(job_id))
if action == 'log':
log = self.service.get_log(job_id)
return HttpResponse(log, content_type='text/plain')
log = io.BytesIO(self.service.get_log(job_id))
# return HttpResponse(log, content_type='text/plain')
return FileResponse(log)
@method_decorator(login_required, name='dispatch')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment