Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: bug cache #20

Merged
merged 3 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
"presets": [
"@babel/preset-env",
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-proposal-class-properties"
]
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"typescript-eslint": "^7.17.0",
"@babel/cli": "^7.24.8",
"@babel/core": "^7.24.9",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.24.8",
"@babel/preset-typescript": "^7.24.7"
},
Expand Down
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