Store each client's play queue in the database
The queue lived in memory and was shared by all clients, so a restart or a finished sync cleared it. Every client now has its own queue in the new queue and queue_song tables (added to the undeployed migration 000006). The music endpoints return the queue ID in the X-Queue-Id header and expect it back. A request without an ID, or with an ended one, starts a new queue. /music/reset ends the queue and returns a new ID, and a sync ends all running queues. Ended queues are kept as history. The deprecated legacy routes without the /api/v1 prefix are removed.
This commit is contained in:
1 parent
b5dc42b654
commit
a705d7b476
28 files changed
+1103
-320
No files matched your search
@@ -65,7 +65,7 @@ func TestMigrationsKeepData(t *testing.T) {
|
||||
assert.Error(t, err, "game table is renamed")
|
||||
}
|
||||
|
||||
func TestFingerprintMigrationDown(t *testing.T) {
|
||||
func TestFingerprintAndQueueMigrationDown(t *testing.T) {
|
||||
database := openDatabase(t, pgtest.NewDatabase(t))
|
||||
m, closeFn, err := database.NewMigrator()
|
||||
require.NoError(t, err)
|
||||
@@ -75,6 +75,8 @@ func TestFingerprintMigrationDown(t *testing.T) {
|
||||
require.NoError(t, m.Steps(-1))
|
||||
assert.Equal(t, 0, count(t, database,
|
||||
"SELECT COUNT(*) FROM information_schema.columns WHERE table_name = 'soundtrack' AND column_name = 'fingerprint'"))
|
||||
assert.Equal(t, 0, count(t, database,
|
||||
"SELECT COUNT(*) FROM information_schema.tables WHERE table_name IN ('queue', 'queue_song')"))
|
||||
require.NoError(t, m.Up())
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user