added WARN_WHEN_USING_OLD_API for fetch as well

This commit is contained in:
Gabriel Grubba
2023-04-04 16:05:37 -03:00
parent 61662fb3cc
commit ab4f07ca2b

View File

@@ -1,4 +1,5 @@
var Fiber = Npm.require('fibers');
var warnUsingOldApi = require("./mongo_driver").warnUsingOldApi;
export class DocFetcher {
constructor(mongoConnection) {
@@ -19,9 +20,14 @@ export class DocFetcher {
fetch(collectionName, id, op, callback) {
const self = this;
check(collectionName, String);
check(op, Object);
// [FIBERS]
// TODO: Remove this when 3.0 is released.
warnUsingOldApi("fetch");
// If there's already an in-progress fetch for this cache key, yield until
// it's done and return whatever it returns.
if (self._callbacksForOp.has(op)) {