Skip to content

Commit 0ec940b

Browse files
Merge pull request #9480 from pavelmash/mormot/pipelineRefactoring
[mORMot] - upgrade to [email protected] with HTTP pipelining mode improvements
2 parents a8e50c5 + 0e9ad23 commit 0ec940b

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

frameworks/Pascal/mormot/setup_and_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ echo "Download statics from $URL ..."
3535
wget -qO- "$URL" | tar -xz -C ./libs/mORMot/static
3636

3737
# uncomment for fixed commit URL
38-
URL=https://github.com/synopse/mORMot2/tarball/2017bddac17a838c9584763e4bd7538aa6f8a529
38+
URL=https://github.com/synopse/mORMot2/tarball/53bee75f81062db0700c97dfa9dfb5e9ce408679
3939
#URL="https://api.github.com/repos/synopse/mORMot2/tarball/$USED_TAG"
4040
echo "Download and unpacking mORMot sources from $URL ..."
4141
wget -qO- "$URL" | tar -xz -C ./libs/mORMot --strip-components=1

frameworks/Pascal/mormot/src/raw.pas

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,7 @@ function TRawAsyncServer.json(ctxt: THttpServerRequest): cardinal;
319319
msgRec: TMessageRec;
320320
begin
321321
msgRec.message := pointer(HELLO_WORLD);
322-
ctxt.SetOutJson(@msgRec, TypeInfo(TMessageRec));
323-
result := HTTP_SUCCESS;
322+
result := ctxt.SetOutJson(@msgRec, TypeInfo(TMessageRec));
324323
end;
325324

326325
function TRawAsyncServer.db(ctxt: THttpServerRequest): cardinal;
@@ -329,8 +328,7 @@ function TRawAsyncServer.db(ctxt: THttpServerRequest): cardinal;
329328
begin
330329
w := TOrmWorld.Create(fStore.Orm, ComputeRandomWorld(Lecuyer));
331330
try
332-
ctxt.SetOutJson(w);
333-
result := HTTP_SUCCESS;
331+
result := ctxt.SetOutJson(w);
334332
finally
335333
w.Free;
336334
end;
@@ -346,9 +344,8 @@ function TRawAsyncServer.queries(ctxt: THttpServerRequest): cardinal;
346344
gen := Lecuyer;
347345
for i := 0 to length(res) - 1 do
348346
res[i] := TOrmWorld.Create(fStore.Orm, ComputeRandomWorld(gen));
349-
ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
347+
result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
350348
ObjArrayClear(res);
351-
result := HTTP_SUCCESS;
352349
end;
353350

354351
function TRawAsyncServer.cached_queries(ctxt: THttpServerRequest): cardinal;
@@ -361,8 +358,7 @@ function TRawAsyncServer.cached_queries(ctxt: THttpServerRequest): cardinal;
361358
gen := Lecuyer;
362359
for i := 0 to length(res) - 1 do
363360
res[i] := fOrmCache.Get(ComputeRandomWorld(gen));
364-
ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
365-
result := HTTP_SUCCESS;
361+
result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
366362
end;
367363

368364
function OrmFortuneCompareByMessage(const A, B): integer;
@@ -436,9 +432,8 @@ function TRawAsyncServer.rawdb(ctxt: THttpServerRequest): cardinal;
436432
stmt.ExecutePrepared;
437433
if stmt.Step then
438434
begin
439-
ctxt.SetOutJson(
435+
result := ctxt.SetOutJson(
440436
'{"id":%,"randomNumber":%}', [stmt.ColumnInt(0), stmt.ColumnInt(1)]);
441-
result := HTTP_SUCCESS;
442437
stmt.ReleaseRows;
443438
end;
444439
stmt := nil;
@@ -450,8 +445,7 @@ function TRawAsyncServer.rawqueries(ctxt: THttpServerRequest): cardinal;
450445
begin
451446
if not GetRawRandomWorlds(GetQueriesParamValue(ctxt), res) then
452447
exit(HTTP_SERVERERROR);
453-
ctxt.SetOutJson(@res, TypeInfo(TWorlds));
454-
result := HTTP_SUCCESS;
448+
result := ctxt.SetOutJson(@res, TypeInfo(TWorlds));
455449
end;
456450

457451
function TRawAsyncServer.rawcached(ctxt: THttpServerRequest): cardinal;
@@ -464,8 +458,7 @@ function TRawAsyncServer.rawcached(ctxt: THttpServerRequest): cardinal;
464458
gen := Lecuyer;
465459
for i := 0 to length(res) - 1 do
466460
res[i] := fRawCache[ComputeRandomWorld(gen) - 1];
467-
ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
468-
result := HTTP_SUCCESS;
461+
result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
469462
end;
470463

471464
function TRawAsyncServer.rawfortunes(ctxt: THttpServerRequest): cardinal;
@@ -555,8 +548,7 @@ function TRawAsyncServer.rawupdates(ctxt: THttpServerRequest): cardinal;
555548
end;
556549
end;
557550
stmt.ExecutePrepared;
558-
ctxt.SetOutJson(@res, TypeInfo(TWorlds));
559-
result := HTTP_SUCCESS;
551+
result := ctxt.SetOutJson(@res, TypeInfo(TWorlds));
560552
end;
561553

562554
// asynchronous PostgreSQL pipelined DB access

0 commit comments

Comments
 (0)