Skip to content

Commit

Permalink
fix: remove unnecessary fork for unpaged result
Browse files Browse the repository at this point in the history
  • Loading branch information
slowbackspace committed Mar 5, 2024
1 parent 203dd22 commit 7877286
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
14 changes: 1 addition & 13 deletions src/routes/txs/hash/required-signers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { getSchemaForEndpoint } from '@blockfrost/openapi';
import { isUnpaged } from '../../../utils/routes.js';
import { toJSONStream } from '../../../utils/string-utils.js';
import { FastifyInstance, FastifyRequest } from 'fastify';
import { SQLQuery } from '../../../sql/index.js';
import * as QueryTypes from '../../../types/queries/tx.js';
Expand Down Expand Up @@ -37,17 +35,7 @@ async function route(fastify: FastifyInstance) {
return reply.send([]);
}

const unpaged = isUnpaged(request);

if (unpaged) {
// Use of Reply.raw functions is at your own risk as you are skipping all the Fastify logic of handling the HTTP response
// https://www.fastify.io/docs/latest/Reference/Reply/#raw
reply.raw.writeHead(200, { 'Content-Type': 'application/json' });
await toJSONStream(rows, reply.raw);
return reply;
} else {
return reply.send(rows);
}
return reply.send(rows);
} catch (error) {
if (clientDbSync) {
clientDbSync.release();
Expand Down
6 changes: 1 addition & 5 deletions yarn-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ cacheEntries = {
"follow-redirects@npm:1.15.2" = { filename = "follow-redirects-npm-1.15.2-1ec1dd82be-faa66059b6.zip"; sha512 = "faa66059b66358ba65c234c2f2a37fcec029dc22775f35d9ad6abac56003268baf41e55f9ee645957b32c7d9f62baf1f0b906e68267276f54ec4b4c597c2b190"; };
"proxy-from-env@npm:1.1.0" = { filename = "proxy-from-env-npm-1.1.0-c13d07f26b-ed7fcc2ba0.zip"; sha512 = "ed7fcc2ba0a33404958e34d95d18638249a68c430e30fcb6c478497d72739ba64ce9810a24f53a7d921d0c065e5b78e3822759800698167256b04659366ca4d4"; };
"prettier-linter-helpers@npm:1.0.0" = { filename = "prettier-linter-helpers-npm-1.0.0-6925131a7e-00ce8011cf.zip"; sha512 = "00ce8011cf6430158d27f9c92cfea0a7699405633f7f1d4a45f07e21bf78e99895911cbcdc3853db3a824201a7c745bd49bfea8abd5fb9883e765a90f74f8392"; };
"cbor@npm:8.1.0" = { filename = "cbor-npm-8.1.0-c1a4d6266a-a90338435d.zip"; sha512 = "a90338435dc7b45cc01461af979e3bb6ddd4f2a08584c437586039cd5f2235014c06e49d664295debbfb3514d87b2f06728092ab6aa6175e2e85e9cd7dc0c1fd"; };
"cbor@npm:9.0.1" = { filename = "cbor-npm-9.0.1-3a5a6b7751-42333ac3d4.zip"; sha512 = "42333ac3d42cc3f6fcc7a529e68417a2dd8099eda43ca4be1304cdc5bc7494efe058e2db8a3d3b46ae60d69c7331ea813c22dbd019c4ac592d23e599d72bbcc9"; };
"blake2b@npm:2.1.3" = { filename = "blake2b-npm-2.1.3-b5b61ec9ad-e652234249.zip"; sha512 = "e652234249cbdb3345488d52b5e76e8572b8e5333f3f0d5e716772b7c5d2142f433c3fe86130e92117329532e1d1235cdaa89f40bbca27a8ae528bef428241ef"; };
"@sentry/node@npm:7.69.0" = { filename = "@sentry-node-npm-7.69.0-5b1090f2f6-97210ced96.zip"; sha512 = "97210ced968a3d968fd9d93e67e1f3c9613b99b223f87fad944e6e94db40ebc10a7c339c848e0529c5ded69f94f1f689b4a6df1da4df1aad6663a752ac591d03"; };
"@types/qs@npm:6.9.7" = { filename = "@types-qs-npm-6.9.7-4a3e6ca0d0-7fd6f9c250.zip"; sha512 = "7fd6f9c25053e9b5bb6bc9f9f76c1d89e6c04f7707a7ba0e44cc01f17ef5284adb82f230f542c2d5557d69407c9a40f0f3515e8319afd14e1e16b5543ac6cdba"; };
"fast-deep-equal@npm:3.1.3" = { filename = "fast-deep-equal-npm-3.1.3-790edcfcf5-e21a9d8d84.zip"; sha512 = "e21a9d8d84f53493b6aa15efc9cfd53dd5b714a1f23f67fb5dc8f574af80df889b3bce25dc081887c6d25457cce704e636395333abad896ccdec03abaf1f3f9d"; };
Expand Down Expand Up @@ -224,7 +222,6 @@ cacheEntries = {
"pg-protocol@npm:1.6.0" = { filename = "pg-protocol-npm-1.6.0-089a4b1d3c-e12662d2de.zip"; sha512 = "e12662d2de2011e0c3a03f6a09f435beb1025acdc860f181f18a600a5495dc38a69d753bbde1ace279c8c442536af9c1a7c11e1d0fe3fad3aa1348b28d9d2683"; };
"@emurgo/cip14-js@npm:3.0.1" = { filename = "@emurgo-cip14-js-npm-3.0.1-6011030ea2-9eaf312410.zip"; sha512 = "9eaf3124108e8c252a745de9ef1f334ab26a32271077b00fe0ea2a06e40838dd435165dac523ebd4d851ae7a94d8c56766dabc372aabffedd36551c798c607c5"; };
"jest-extended@npm:3.2.4" = { filename = "jest-extended-npm-3.2.4-b882af7fa5-16e4f300d9.zip"; sha512 = "16e4f300d9c5bf110f7f3422e49e06c968a99a44cede2b2821ddd480c33b3d9cd4dc58035b2f022e6018247da8f887295d6c2499647675dedb6e305142604e7d"; };
"blake2b-wasm@npm:1.1.7" = { filename = "blake2b-wasm-npm-1.1.7-ac747aaa82-be5ebacdd2.zip"; sha512 = "be5ebacdd25076ae5fcaf1c60c37096c85490a36ee1f8e78d5c4c2fb8ccad0fe0e22cecadba6fcf6ed7d91c1aed9c55980811fe064fafb4ccd80ac34a8a326ea"; };
"@vitest/coverage-v8@npm:1.2.2" = { filename = "@vitest-coverage-v8-npm-1.2.2-38d2f25b60-0f0fc98b17.zip"; sha512 = "0f0fc98b17cd4d9c292f3f381b676fb8f5b1480d261541a676d1a307e2c9f39a9d59fb497f963b18802b4f7065ace3fdc5e6f9f95d9379560aa4ac5f09f6918e"; };
"punycode@npm:2.1.1" = { filename = "punycode-npm-2.1.1-26eb3e15cf-823bf443c6.zip"; sha512 = "823bf443c6dd14f669984dea25757b37993f67e8d94698996064035edd43bed8a5a17a9f12e439c2b35df1078c6bec05a6c86e336209eb1061e8025c481168e8"; };
"shebang-command@npm:2.0.0" = { filename = "shebang-command-npm-2.0.0-eb2b01921d-6b52fe8727.zip"; sha512 = "6b52fe87271c12968f6a054e60f6bde5f0f3d2db483a1e5c3e12d657c488a15474121a1d55cd958f6df026a54374ec38a4a963988c213b7570e1d51575cea7fa"; };
Expand Down Expand Up @@ -321,8 +318,8 @@ cacheEntries = {
"strip-json-comments@npm:3.1.1" = { filename = "strip-json-comments-npm-3.1.1-dcb2324823-492f73e272.zip"; sha512 = "492f73e27268f9b1c122733f28ecb0e7e8d8a531a6662efbd08e22cccb3f9475e90a1b82cab06a392f6afae6d2de636f977e231296400d0ec5304ba70f166443"; };
"@sinonjs/commons@npm:2.0.0" = { filename = "@sinonjs-commons-npm-2.0.0-3716f24f20-5023ba17ed.zip"; sha512 = "5023ba17edf2b85ed58262313b8e9b59e23c6860681a9af0200f239fe939e2b79736d04a260e8270ddd57196851dde3ba754d7230be5c5234e777ae2ca8af137"; };
"@cspotcode/source-map-support@npm:0.8.1" = { filename = "@cspotcode-source-map-support-npm-0.8.1-964f2de99d-5718f26708.zip"; sha512 = "5718f267085ed8edb3e7ef210137241775e607ee18b77d95aa5bd7514f47f5019aa2d82d96b3bf342ef7aa890a346fa1044532ff7cc3009e7d24fce3ce6200fa"; };
"blake2b@npm:2.1.3" = { filename = "blake2b-npm-2.1.3-b5b61ec9ad-e652234249.zip"; sha512 = "e652234249cbdb3345488d52b5e76e8572b8e5333f3f0d5e716772b7c5d2142f433c3fe86130e92117329532e1d1235cdaa89f40bbca27a8ae528bef428241ef"; };
"cbor@npm:8.1.0" = { filename = "cbor-npm-8.1.0-c1a4d6266a-a90338435d.zip"; sha512 = "a90338435dc7b45cc01461af979e3bb6ddd4f2a08584c437586039cd5f2235014c06e49d664295debbfb3514d87b2f06728092ab6aa6175e2e85e9cd7dc0c1fd"; };
"blake2b@npm:2.1.3" = { filename = "blake2b-npm-2.1.3-b5b61ec9ad-e652234249.zip"; sha512 = "e652234249cbdb3345488d52b5e76e8572b8e5333f3f0d5e716772b7c5d2142f433c3fe86130e92117329532e1d1235cdaa89f40bbca27a8ae528bef428241ef"; };
"assert-options@npm:0.8.1" = { filename = "assert-options-npm-0.8.1-ed3051eefd-aaf86a9c6a.zip"; sha512 = "aaf86a9c6a330e43172544ce2cc2b59bf8b4338dd0933d852e9b7efbae7b801944671e7dd6cc172d0dcfc88713009d88dca56cc34c8d4ba7fc5aeb1cf3e9bcef"; };
"pg-minify@npm:1.6.3" = { filename = "pg-minify-npm-1.6.3-fef1d2601d-5b9868f2b9.zip"; sha512 = "5b9868f2b90b9629455db6e13c35b1228b65803bbf9fc1a02d49fe147b55bb20eed53d368bf8f9f8127a2e740697b20702702e58f4846d9f5f3749d840a14c99"; };
"spex@npm:3.3.0" = { filename = "spex-npm-3.3.0-833f63faad-c2797eae65.zip"; sha512 = "c2797eae658e0f97b92775a9a87cd6d615e87693b4d5abfd3120543391e3eeab2755ab101489752f3ff47c1e0623737a604c5411e8f9bca7714d4e0427c182c0"; };
Expand Down Expand Up @@ -413,7 +410,6 @@ cacheEntries = {
"light-my-request@npm:5.11.0" = { filename = "light-my-request-npm-5.11.0-d6f35c2a2c-f639edb466.zip"; sha512 = "f639edb4664534bfcc87aff3fc36e7199ef5b04c399ce51a87481786d23ad1d439a71a5beeada5d0fe607c9d6efccbcd1bef265f31397e130f4077d43cc6d45f"; };
"atomic-sleep@npm:1.0.0" = { filename = "atomic-sleep-npm-1.0.0-17d8a762a3-b95275afb2.zip"; sha512 = "b95275afb2f80732f22f43a60178430c468906a415a7ff18bcd0feeebc8eec3930b51250aeda91a476062a90e07132b43a1794e8d8ffcf9b650e8139be75fa36"; };
"blake2b-wasm@npm:1.1.7" = { filename = "blake2b-wasm-npm-1.1.7-ac747aaa82-be5ebacdd2.zip"; sha512 = "be5ebacdd25076ae5fcaf1c60c37096c85490a36ee1f8e78d5c4c2fb8ccad0fe0e22cecadba6fcf6ed7d91c1aed9c55980811fe064fafb4ccd80ac34a8a326ea"; };
"jest-matcher-utils@npm:29.3.1" = { filename = "jest-matcher-utils-npm-29.3.1-5d9d00434d-311e8d9f1e.zip"; sha512 = "311e8d9f1e935216afc7dd8c6acf1fbda67a7415e1afb1bf72757213dfb025c1f2dc5e2c185c08064a35cdc1f2d8e40c57616666774ed1b03e57eb311c20ec77"; };
"jest-matcher-utils@npm:29.7.0" = { filename = "jest-matcher-utils-npm-29.7.0-dfc74b630e-d7259e5f99.zip"; sha512 = "d7259e5f995d915e8a37a8fd494cb7d6af24cd2a287b200f831717ba0d015190375f9f5dc35393b8ba2aae9b2ebd60984635269c7f8cff7d85b077543b7744cd"; };
"istanbul-lib-coverage@npm:3.2.0" = { filename = "istanbul-lib-coverage-npm-3.2.0-93f84b2c8c-a2a545033b.zip"; sha512 = "a2a545033b9d56da04a8571ed05c8120bf10e9bce01cf8633a3a2b0d1d83dff4ac4fe78d6d5673c27fc29b7f21a41d75f83a36be09f82a61c367b56aa73c1ff9"; };
"source-map@npm:0.6.1" = { filename = "source-map-npm-0.6.1-1a3621db16-59ce8640cf.zip"; sha512 = "59ce8640cf3f3124f64ac289012c2b8bd377c238e316fb323ea22fbfe83da07d81e000071d7242cad7a23cd91c7de98e4df8830ec3f133cb6133a5f6e9f67bc2"; };
Expand Down

0 comments on commit 7877286

Please sign in to comment.