You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 30, 2024. It is now read-only.
The function contains a synchronized process.Such as
// A getter methodvargetData;Sync(function(){//But it doe's not work.getData=function(path){varcacheDoc=cache.get(this.id);//"cache" is a "node-cache"if(!cacheDoc||cacheDoc[path]===undefined){cacheDoc=statics.findById.sync(this,this.id,cachedPathsStr);//mongoose findById}returncacheDoc[path];};});
The code above will not work because of the fiber cannot be detected.
I also tried other way.
// A getter methodvargetData=function(path){Sync(function(){varcacheDoc=cache.get(this.id);//"cache" is a "node-cache"if(!cacheDoc||cacheDoc[path]===undefined){cacheDoc=statics.findById.sync(this,this.id,cachedPathsStr);//mongoose findById}});returncacheDoc[path];};
The execution will jump to the "return" statement unless the "return" is contained in the "Sync".
I have to put the whole function into it, and put the code which call this method.
I can't export the module if I put module.export = moduleObj into the "Sync" capsule, because of the same problem: Error: yield() called with no fiber running