linkeddata / rdflib.js

Linked Data API for JavaScript
http://linkeddata.github.io/rdflib.js/doc/
Other
565 stars 143 forks source link

FetchQueue errors #461

Open jeff-zucker opened 3 years ago

jeff-zucker commented 3 years ago

[Edit : I originally thought this was limited to file: URIs and to the updater but more testing and a report from @JanSchill I see it impacts https: URIs also and any fetcher operation after a fetcher.load. See next comment for a better statement of the issue]

Fetcher and update-manager operations succeed against file://URIs, but emit a fetchQueue error as shown below. Note that the error is emitted, but then the operation succeeds (and the correct patch is applied).

Internal error - fetchQueue exists file:///home/jeff/Dropbox/Web/solid/rdflib/rdflib.js/test.ttl
*** Fetcher: pending fetchQueue deleted file:///home/jeff/Dropbox/Web/solid/rdflib/rdflib.js/test.ttl
    UpdateManager: Return success 200 elapsed 6ms
jeff-zucker commented 3 years ago

The attached script produces the fetchQueue error shown above: As far as I can see, the problem is that the timeout loop starting at line 1009 in fetcher.cleanupFetchRequest]() never executes.

/** CHANGE THIS TO A LOCATION YOU HAVE WRITE ACCESS TO                          
 */                                                                             
const testUrl = `https://jeff-zucker.solidcommunity.net/public/fetchQueue.ttl`; 

const SolidNodeClient = require('solid-node-client').SolidNodeClient;           
const $rdf = require('rdflib')                                                  
const client = new SolidNodeClient();                                           

const store     = $rdf.graph();                                                 
const fetcher   = $rdf.fetcher(store,{fetch:client.fetch.bind(client)});        
const subject   = store.sym(testUrl+"#this");                                           
const predicate = store.sym('https://example.org/message');                     
const object    = store.literal('hello world');                                 
const document  = subject.doc();                                                

async function main(){                                                          
  await client.login()                                                          
  store.add( subject, predicate, object, document );                            
  await fetcher.putBack( document );
  await fetcher.load( document );                                               
  await fetcher.webOperation('DELETE',document);                                
}                                                                               
main(); 
// ENDS

[Edited for clarity]