Downgrade to v13

[vi] cảm giác đau khổ
This commit is contained in:
March 7th
2022-03-24 17:55:32 +07:00
parent 9596b1a210
commit 7dfdef46a5
218 changed files with 8584 additions and 9108 deletions

View File

@@ -1,6 +1,7 @@
'use strict';
const DataManager = require('./DataManager');
const { _cleanupSymbol } = require('../util/Constants');
/**
* Manages the API methods of a data model with a mutable cache of instances.
@@ -13,6 +14,19 @@ class CachedManager extends DataManager {
Object.defineProperty(this, '_cache', { value: this.client.options.makeCache(this.constructor, this.holds) });
let cleanup = this._cache[_cleanupSymbol]?.();
if (cleanup) {
cleanup = cleanup.bind(this._cache);
client._cleanups.add(cleanup);
client._finalizers.register(this, {
cleanup,
message:
`Garbage collection completed on ${this.constructor.name}, ` +
`which had a ${this._cache.constructor.name} of ${this.holds.name}.`,
name: this.constructor.name,
});
}
if (iterable) {
for (const item of iterable) {
this._add(item);