mirror of
https://github.com/gotoeasy/glogcenter.git
synced 2025-09-15 12:58:34 +08:00
fix:清理集群同步数据时的临时文件
This commit is contained in:
parent
d1772a0304
commit
b875fe7168
@ -95,6 +95,7 @@ func checkAndCopyDataFromRemote() {
|
|||||||
cmn.Info("本地无日志仓", k, "开始从", remoteStore.NodeUrl, "复制", remoteStore.Name)
|
cmn.Info("本地无日志仓", k, "开始从", remoteStore.NodeUrl, "复制", remoteStore.Name)
|
||||||
tarfile, err := httpDownloadStoreFile(remoteStore.NodeUrl, remoteStore.Name) // 下载
|
tarfile, err := httpDownloadStoreFile(remoteStore.NodeUrl, remoteStore.Name) // 下载
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
cmn.RemoveAllFile(tarfile)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +104,7 @@ func checkAndCopyDataFromRemote() {
|
|||||||
distDir := filepath.Join(conf.GetStorageRoot(), storeName)
|
distDir := filepath.Join(conf.GetStorageRoot(), storeName)
|
||||||
cmn.MkdirAll(distDir)
|
cmn.MkdirAll(distDir)
|
||||||
cmn.UnTar(tarfile, distDir)
|
cmn.UnTar(tarfile, distDir)
|
||||||
|
cmn.RemoveAllFile(tarfile)
|
||||||
|
|
||||||
// 保存信息
|
// 保存信息
|
||||||
sysdb := sysmnt.NewSysmntStorage()
|
sysdb := sysmnt.NewSysmntStorage()
|
||||||
|
|||||||
@ -40,5 +40,13 @@ func ClusterDownloadStoreDataController(req *gweb.HttpRequest) *gweb.HttpResult
|
|||||||
ctx.Header("Content-Transfer-Encoding", "binary")
|
ctx.Header("Content-Transfer-Encoding", "binary")
|
||||||
ctx.File(tarfilename)
|
ctx.File(tarfilename)
|
||||||
|
|
||||||
|
go deleteTarfilename(tarfilename)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func deleteTarfilename(tarfilename string) {
|
||||||
|
// 5分钟后删除
|
||||||
|
time.Sleep(5 * time.Minute)
|
||||||
|
cmn.RemoveAllFile(tarfilename)
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user