pendingGenerateTimeout
property? No matter what value I set or not defining it, I can't seem to get concurrent access to a cache item working. It always queues it up and the same object is returned. Here's the sample code. I try to access /route1 and then wait a few seconds then access /route2, but they both return the same exact item. I would expect that since there is no cached item initially, that the calls to /route1 and /route2 should return different objects? function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
const querySchemaMetadata = async () => {
console.log(`regenerating cache ${(new Date()).toLocaleTimeString()}`);
await sleep(9000);
return Promise.resolve([{id: `${(new Date()).getMilliseconds()}`}]);
};
server.method('querySchemaMetadata', querySchemaMetadata, {
cache: {
expiresIn: 60 * 60 * 1000, // 1hr
/**
* provides a 15 second timeout querySchemaMetadata to return. Otherwise, returns a timeout error
*/
generateTimeout: false,
//generateTimeout: 15 * 1000,
/**
* returns a wrapped object of the value that includes additional stats metadata
*/
getDecoratedValue: true,
/**
* allow multiple simultaneous access requests to this cache item to be queued for up to a duration of
* 10 seconds before a separate access request is allowed.
*/
pendingGenerateTimeout: 2000,
}
});
server.route({
path: '/route1',
method: 'GET',
handler: async function (request, h) {
await server.methods.querySchemaMetadata()
}
});
server.route({
path: '/route2',
method: 'GET',
handler: async function (request, h) {
await server.methods.querySchemaMetadata();
}
});
GET
from the browser into hapi besides cors: true
?
...
const server = Hapi.server({
port: 9000,
host: 'localhost',
routes: {
cors: true
}
});
server.route({
method: 'GET',
path: '/',
handler: (request, h) => {
return 'Hello World!';
}
});
...
Response {type: "cors", url: "http://localhost:9000/", redirected: false, status: 200, ok: true, …}
body: (...)
bodyUsed: false
headers: Headers {}
ok: true
redirected: false
status: 200
statusText: "OK"
type: "cors"
url: "http://localhost:9000/"
__proto__: Response
/providers/{providerId}/fulfillers/{fulfillerId}/customers/{customerId}
? https://hapi.dev/api/?v=20.0.3#path-parameters says hapi can only match one. Do I really have to use /providers/{things*}
then do something like things.split('/')
? Seems like a burden.
since I could set one cookie using (request.cookieAuth.set(data1)), setting one more data makes it more than 4k.
I wanted to set 1 more cookie so , I did
return reply.redirect(nextPath).state('data2', data2);
but for some users , its not being set , could someone help me with this pls.