feat: optimize background tasks and fix warehouse pricelist workflow
Optimize task retention from 5 minutes to 30 seconds to reduce polling overhead since toast notifications are shown only once. Add conditional warehouse pricelist creation via checkbox. Fix category storage in warehouse pricelists to properly load from lot table. Replace SSE with task polling for all long operations. Add comprehensive logging for debugging while minimizing noise from polling endpoints. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -652,6 +652,12 @@ func openBrowser(url string) error {
|
||||
}
|
||||
|
||||
func requestLogger() gin.HandlerFunc {
|
||||
// Skip logging for frequent polling endpoints
|
||||
skipPaths := map[string]bool{
|
||||
"/api/tasks": true,
|
||||
"/api/db-status": true,
|
||||
}
|
||||
|
||||
return func(c *gin.Context) {
|
||||
start := time.Now()
|
||||
path := c.Request.URL.Path
|
||||
@@ -659,6 +665,11 @@ func requestLogger() gin.HandlerFunc {
|
||||
|
||||
c.Next()
|
||||
|
||||
// Skip logging for frequent polling endpoints
|
||||
if skipPaths[path] {
|
||||
return
|
||||
}
|
||||
|
||||
latency := time.Since(start)
|
||||
status := c.Writer.Status()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user