Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: add log to debug relations removal issue

Abdullah Atta24141b66cf29
diff --git a/packages/core/src/collections/relations.js b/packages/core/src/collections/relations.js
index d898c9a90..b94a43907 100644
--- a/packages/core/src/collections/relations.js
+++ b/packages/core/src/collections/relations.js
@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+import { logger } from "../logger";
import { makeId } from "../utils/id";
import Collection from "./collection";
@@ -190,6 +191,7 @@ export default class Relations extends Collection {
}
async cleanup() {
+ const relationsLogger = logger.scope("Relations");
const relations = this._collection.getItems();
for (const relation of relations) {
const references = [relation.to, relation.from];
@@ -210,7 +212,13 @@ export default class Relations extends Collection {
this._db.trash.exists(reference.id);
break;
}
- if (!exists) await this.remove(relation.id);
+ if (!exists) {
+ relationsLogger.debug(
+ `Removing relation during cleanup`,
+ relation.id
+ );
+ await this.remove(relation.id);
+ }
}
}
}