Skip to content

Commit d4060f2

Browse files
Add expiry parameter to cached get handler registration
1 parent 7ad4654 commit d4060f2

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎src/AppWrapper.h‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,12 @@ void uWS_App(const FunctionCallbackInfo<Value> &args) {
938938
if constexpr (std::is_same<APP, uWS::App>::value) {
939939

940940
if (args.Length() == 3) {
941+
942+
/* Get secondsToExpiry */
943+
unsigned int secondsToExpiry = args[2]->Uint32Value(args.GetIsolate()->GetCurrentContext()).ToChecked();
944+
941945
/* Use cached variant */
942-
std::cout << "Registering cached get handler" << std::endl;
946+
std::cout << "Registering cached get handler with expiry = " << secondsToExpiry << std::endl;
943947

944948

945949
APP *app = (APP *) getInternalPointer(args.This());//->GetAlignedPointerFromInternalField(0);
@@ -983,7 +987,7 @@ void uWS_App(const FunctionCallbackInfo<Value> &args) {
983987

984988
/* µWS itself will terminate if not responded and not attached
985989
* onAborted handler, so we can assume it's done */
986-
}, 13);
990+
}, secondsToExpiry);
987991

988992
args.GetReturnValue().Set(args.This());
989993

0 commit comments

Comments
 (0)