Set maximum buffer size fixes #1135
This commit is contained in:
@@ -30,7 +30,7 @@ export default {
|
||||
methods: {
|
||||
loadLogs(id) {
|
||||
this.reset();
|
||||
this.es = new EventSource(`${config.base}/api/logs/stream?id=${this.id}`);
|
||||
this.es = new EventSource(`${config.base}/api/logs/stream?id=${id}`);
|
||||
this.es.addEventListener("container-stopped", (e) => {
|
||||
this.es.close();
|
||||
this.buffer.push({ event: "container-stopped", message: "Container stopped", date: new Date() });
|
||||
|
||||
@@ -100,6 +100,9 @@ func (h *handler) streamLogs(w http.ResponseWriter, r *http.Request) {
|
||||
defer reader.Close()
|
||||
|
||||
scanner := bufio.NewScanner(reader)
|
||||
const maxCapacity = 1024 * 1024
|
||||
buf := make([]byte, maxCapacity)
|
||||
scanner.Buffer(buf, maxCapacity)
|
||||
for scanner.Scan() {
|
||||
message := scanner.Text()
|
||||
fmt.Fprintf(w, "data: %s\n", message)
|
||||
|
||||
Reference in New Issue
Block a user