Phase 3.5: Finalized UI polish, added Console, and fixed stale stream status bug
This commit is contained in:
@@ -41,5 +41,8 @@ func InitDB() {
|
||||
log.Fatalf("Failed to migrate database: %v", err)
|
||||
}
|
||||
|
||||
// Phase 3.5 Fix: Reset all rooms to inactive on startup using explicit map to ensure false is updated
|
||||
DB.Model(&model.Room{}).Where("1 = 1").Updates(map[string]interface{}{"is_active": false})
|
||||
|
||||
log.Println("Database initialized successfully.")
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ func NewRTMPServer() *RTMPServer {
|
||||
s.channels[roomLivePath] = q
|
||||
s.mutex.Unlock()
|
||||
|
||||
// Mark room as active in DB
|
||||
db.DB.Model(&room).Update("is_active", true)
|
||||
// Mark room as active in DB (using map to ensure true/false is correctly updated)
|
||||
db.DB.Model(&room).Updates(map[string]interface{}{"is_active": true})
|
||||
|
||||
// 3. Cleanup on end
|
||||
defer func() {
|
||||
@@ -81,7 +81,8 @@ func NewRTMPServer() *RTMPServer {
|
||||
delete(s.channels, roomLivePath)
|
||||
s.mutex.Unlock()
|
||||
q.Close()
|
||||
db.DB.Model(&room).Update("is_active", false) // Mark room as inactive
|
||||
// Explicitly set is_active to false using map
|
||||
db.DB.Model(&room).Updates(map[string]interface{}{"is_active": false})
|
||||
fmt.Printf("[INFO] Publishing ended for Room ID: %d\n", room.ID)
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user