Browse Source

fix: 解决容器日志文件被删除但是进程未结束的问题 (#4588)

Refs #4582
pull/4599/head
ssongliu 7 months ago committed by GitHub
parent
commit
a4ee16cf1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      backend/app/service/container.go
  2. 7
      frontend/src/components/compose-log/index.vue
  3. 1
      frontend/src/components/container-log/index.vue

2
backend/app/service/container.go

@ -701,7 +701,7 @@ func (u *ContainerService) ContainerLogs(wsConn *websocket.Conn, containerType,
return
}
global.LOG.Errorf("read bytes from log failed, err: %v", err)
continue
return
}
if !utf8.Valid(buffer[:n]) {
continue

7
frontend/src/components/compose-log/index.vue

@ -53,7 +53,7 @@
<script lang="ts" setup>
import i18n from '@/lang';
import { dateFormatForName, downloadWithContent } from '@/utils/util';
import { computed, reactive, ref, shallowRef, watch } from 'vue';
import { computed, onBeforeUnmount, reactive, ref, shallowRef, watch } from 'vue';
import { Codemirror } from 'vue-codemirror';
import { javascript } from '@codemirror/lang-javascript';
import { oneDark } from '@codemirror/theme-one-dark';
@ -128,6 +128,7 @@ const searchLogs = async () => {
MsgError(i18n.global.t('container.linesHelper'));
return;
}
terminalSocket.value?.send('close conn');
terminalSocket.value?.close();
logInfo.value = '';
const href = window.location.href;
@ -180,6 +181,10 @@ const acceptParams = (props: DialogProps): void => {
}
};
onBeforeUnmount(() => {
handleClose();
});
defineExpose({
acceptParams,
});

1
frontend/src/components/container-log/index.vue

@ -102,6 +102,7 @@ const searchLogs = async () => {
MsgError(i18n.global.t('container.linesHelper'));
return;
}
terminalSocket.value?.send('close conn');
terminalSocket.value?.close();
logInfo.value = '';
const href = window.location.href;

Loading…
Cancel
Save