Skip to content

Commit

Permalink
chore: Update search cache handling in Manager.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
EvarinDev committed Jul 27, 2024
1 parent e7ab944 commit 27c9152
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/structures/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ export class Manager extends TypedEmitter<ManagerEvents> {
let search = _query.query;
let code = this.CheckURL(options.query);
if (!/^https?:\/\//.test(search)) search = `${_source}:${search}`;
if (this.search_cache.get(code)) return this.search_cache.get(code);
if (options.cache !== false && this.options.cache.enabled !== false) {
if (this.search_cache.get(code)) return this.search_cache.get(code);
}
try {
const res = (await node.rest.get(`/v4/loadtracks?identifier=${encodeURIComponent(search)}`)) as LavalinkResponse;
if (!res) throw new Error("Query not found.");
Expand Down

0 comments on commit 27c9152

Please sign in to comment.