mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-03 15:06:36 +08:00
refactor(core): optimize performance, fix concurrency and clean up AGENTS.md design violations
- Concurrency: Added lock protection to WebSocket writes, fixed timer leaks, and prevented config cache listener context leaks. - Performance: Added memory cache in ObservabilityBufferStore, periodic cleaning in CH Deduplicator, and buffered ZIP batch download writes. - Design: Introduced Redis caching for OAuth session/tokens, sanitized raw DB error messages, segregated handlers and logics, and standard CAP response envelopes.
This commit is contained in:
@@ -7,6 +7,7 @@ package handler
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"bufio"
|
||||
"bytes"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
@@ -247,8 +248,12 @@ func BatchDownloadFiles(c *gin.Context) {
|
||||
c.Header("Content-Type", "application/zip")
|
||||
c.Header("Content-Disposition", "attachment; filename=\"batch_download.zip\"")
|
||||
|
||||
zipWriter := zip.NewWriter(c.Writer)
|
||||
defer func() { _ = zipWriter.Close() }()
|
||||
bufferedWriter := bufio.NewWriter(c.Writer)
|
||||
zipWriter := zip.NewWriter(bufferedWriter)
|
||||
defer func() {
|
||||
_ = zipWriter.Close()
|
||||
_ = bufferedWriter.Flush()
|
||||
}()
|
||||
|
||||
usedNames := make(map[string]int)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user