8 Commits

Author SHA1 Message Date
jamie 854268d80a Merge pull request 'fix: update database connection DSN to use UTC timezone instead of Local' (#14) from v1.0.2 into main
Reviewed-on: http://git.jdbnet.co.uk/jamie/goencode/pulls/14
2026-07-11 15:21:36 +01:00
jamie ed6f5f47bf fix: update database connection DSN to use UTC timezone instead of Local
Release / release (pull_request) Successful in 1m20s
2026-07-11 15:21:25 +01:00
jamie 181424ac70 Merge pull request 'V1.0.1' (#13) from v1.0.1 into main
Reviewed-on: http://git.jdbnet.co.uk/jamie/goencode/pulls/13
2026-06-17 08:44:46 +01:00
jamie ae869e7a2e fix: trigger queue processing immediately after adding a new job
Release / release (pull_request) Successful in 1m16s
2026-06-17 08:44:31 +01:00
jamie 173c317238 refactor: process files concurrently and add stability check before queueing while ignoring the binary output 2026-06-17 08:42:54 +01:00
jamie 6a678abc9f Merge pull request 'fix: use clean version variable for binary build flags and docker build arguments' (#11) from v1.0.0 into main
Reviewed-on: http://git.jdbnet.co.uk/jamie/goencode/pulls/11
2026-06-12 14:45:50 +01:00
jamie 3aa3692384 Merge pull request 'feat: inject version string into binary via Docker build argument' (#10) from v1.0.0 into main
Reviewed-on: http://git.jdbnet.co.uk/jamie/goencode/pulls/10
2026-06-12 14:43:38 +01:00
jamie 9899a32648 Merge pull request 'feat: add application versioning to UI and implement automated release workflow via Gitea Actions' (#9) from v1.0.0 into main
Reviewed-on: http://git.jdbnet.co.uk/jamie/goencode/pulls/9
2026-06-12 14:39:06 +01:00
4 changed files with 31 additions and 4 deletions
+2 -1
View File
@@ -1 +1,2 @@
media/
media/
goencode
+1 -1
View File
@@ -13,7 +13,7 @@ import (
var DB *sql.DB
func Init(cfg *config.DatabaseConfig) error {
dsn := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?parseTime=true&loc=Local",
dsn := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?parseTime=true&loc=UTC",
cfg.User, cfg.Password, cfg.Host, cfg.Port, cfg.Name)
var err error
+27 -2
View File
@@ -138,7 +138,7 @@ func (m *Manager) processWorker() {
case <-m.stopChan:
return
case path := <-m.processChan:
m.processFile(path)
go m.processFile(path)
}
}
}
@@ -151,7 +151,7 @@ func (m *Manager) handleEvent(filePath string) {
t.Stop()
}
m.timers[filePath] = time.AfterFunc(5*time.Second, func() {
m.timers[filePath] = time.AfterFunc(2*time.Minute, func() {
m.timersMu.Lock()
delete(m.timers, filePath)
m.timersMu.Unlock()
@@ -176,6 +176,31 @@ func (m *Manager) processFile(filePath string) {
return
}
// Wait until the file is fully copied and stable
var lastSize int64 = info.Size()
var lastModTime time.Time = info.ModTime()
var stableCount int
for {
time.Sleep(5 * time.Second)
currentInfo, err := os.Stat(filePath)
if err != nil {
return // File was likely deleted during copying
}
if currentInfo.Size() == lastSize && currentInfo.ModTime().Equal(lastModTime) {
stableCount++
if stableCount >= 3 { // Stable for 15 seconds
break
}
} else {
stableCount = 0
lastSize = currentInfo.Size()
lastModTime = currentInfo.ModTime()
}
}
// Re-check after waiting
alreadyInQueue, err := db.IsFileAlreadyProcessedOrQueued(filePath)
if err != nil {
log.Printf("Error checking DB for %s: %v", filePath, err)
+1
View File
@@ -165,5 +165,6 @@ func (s *Server) handleRequeueJob(w http.ResponseWriter, r *http.Request) {
s.qm.NotifySSE("queue_updated", nil)
s.qm.NotifySSE("job_added", nil)
s.qm.Trigger()
w.WriteHeader(http.StatusOK)
}