Skip to content

dataloader cached promises always pending #85

@marcosrmendezthd

Description

@marcosrmendezthd

Hi,

I've followed the same pattern for the connector in my own code. What I'm noticing though is that the requests never get to use the cache because the promises seem to always be pending.

Are you seeing this or perhaps this is an error in my code?

` return Promise.all(urls.map((url) => {

        console.log("fetching", url);
        const cachedRes = this.eTagCache[url];

        if (cachedRes && cachedRes.eTag) {
            options.headers['If-None-Match'] = cachedRes.eTag;
        }
        console.log("cache", this.loader); // cached promises are always pending

        return new Promise((resolve, reject) => {
            this.rp({
                uri: url,
                ...options,
            }).then((response) => { resolve(response) ... }.catch((err) => {reject(err) ... }`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions