magmastream 2.9.0-dev.11 → 2.9.0-dev.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,8 +6,6 @@ const logExecutionTime_1 = require("../utils/logExecutionTime");
|
|
|
6
6
|
class RedisQueue {
|
|
7
7
|
guildId;
|
|
8
8
|
manager;
|
|
9
|
-
current = null;
|
|
10
|
-
previous = [];
|
|
11
9
|
redis;
|
|
12
10
|
redisPrefix;
|
|
13
11
|
constructor(guildId, manager) {
|
|
@@ -79,11 +77,10 @@ class RedisQueue {
|
|
|
79
77
|
const serialized = tracks.map((t) => this.serialize(t));
|
|
80
78
|
const oldPlayer = this.manager.players.get(this.guildId) ? { ...this.manager.players.get(this.guildId) } : null;
|
|
81
79
|
// If there's no current track, pop one from the list
|
|
82
|
-
if (!this.
|
|
80
|
+
if (!(await this.getCurrent())) {
|
|
83
81
|
const current = serialized.shift();
|
|
84
82
|
if (current) {
|
|
85
|
-
await this.
|
|
86
|
-
this.current = this.deserialize(current);
|
|
83
|
+
await this.setCurrent(this.deserialize(current));
|
|
87
84
|
}
|
|
88
85
|
}
|
|
89
86
|
if (typeof offset === "number" && !isNaN(offset)) {
|
|
@@ -175,13 +172,13 @@ class RedisQueue {
|
|
|
175
172
|
async totalSize() {
|
|
176
173
|
return (0, logExecutionTime_1.logExecutionTime)("totalSize (RedisQueue)", async () => {
|
|
177
174
|
const size = await this.size();
|
|
178
|
-
return this.
|
|
175
|
+
return (await this.getCurrent()) ? size + 1 : size;
|
|
179
176
|
});
|
|
180
177
|
}
|
|
181
178
|
async duration() {
|
|
182
179
|
return (0, logExecutionTime_1.logExecutionTime)("duration (RedisQueue)", async () => {
|
|
183
180
|
const tracks = await this.redis.lrange(this.queueKey, 0, -1);
|
|
184
|
-
const currentDuration = this.
|
|
181
|
+
const currentDuration = (await this.getCurrent())?.duration || 0;
|
|
185
182
|
const total = tracks.reduce((acc, raw) => {
|
|
186
183
|
try {
|
|
187
184
|
const parsed = this.deserialize(raw);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magmastream",
|
|
3
|
-
"version": "2.9.0-dev.
|
|
3
|
+
"version": "2.9.0-dev.12",
|
|
4
4
|
"description": "A user-friendly Lavalink client designed for NodeJS.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -90,4 +90,4 @@
|
|
|
90
90
|
"homepage": "https://docs.magmastream.com",
|
|
91
91
|
"author": "Abel Purnwasy",
|
|
92
92
|
"license": "Apache-2.0"
|
|
93
|
-
}
|
|
93
|
+
}
|