Merge develop: Fix SSE timeout issues

This commit is contained in:
eduard256
2025-11-22 20:35:48 +03:00
2 changed files with 8 additions and 14 deletions
+7 -13
View File
@@ -409,26 +409,20 @@ func (s *Scanner) testStreamsConcurrently(ctx context.Context, streams []models.
defer cancelProgress() defer cancelProgress()
go func() { go func() {
ticker := time.NewTicker(3 * time.Second) ticker := time.NewTicker(1 * time.Second)
defer ticker.Stop() defer ticker.Stop()
lastTested := int32(0)
for { for {
select { select {
case <-progressCtx.Done(): case <-progressCtx.Done():
return return
case <-ticker.C: case <-ticker.C:
currentTested := atomic.LoadInt32(&tested) // Send progress every second to prevent WriteTimeout
// Only send if there's been progress _ = streamWriter.SendJSON("progress", models.ProgressMessage{
if currentTested != lastTested { Tested: int(atomic.LoadInt32(&tested)),
_ = streamWriter.SendJSON("progress", models.ProgressMessage{ Found: int(atomic.LoadInt32(&found)),
Tested: int(currentTested), Remaining: len(streams) - int(atomic.LoadInt32(&tested)),
Found: int(atomic.LoadInt32(&found)), })
Remaining: len(streams) - int(currentTested),
})
lastTested = currentTested
}
} }
} }
}() }()
+1 -1
View File
@@ -73,7 +73,7 @@ func Load() *Config {
Server: ServerConfig{ Server: ServerConfig{
Listen: ":4567", // Default listen address Listen: ":4567", // Default listen address
ReadTimeout: 30 * time.Second, ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second, WriteTimeout: 5 * time.Minute, // Increased for SSE long-polling
}, },
Database: DatabaseConfig{ Database: DatabaseConfig{
DataPath: dataPath, DataPath: dataPath,