Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix zombie process #237

Merged
merged 3 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"url": "https://github.com/UW-Macrostrat/macrostrat-api.git"
},
"scripts": {
"start": "nodemon --watch v2 --exec ts-node --transpileOnly server.ts",
"dev": "nodemon --watch v2 --exec ts-node --transpileOnly server.ts",
"start": "ts-node --transpileOnly server.ts",
"docker": "docker build -t macrostrat-api . && docker run --rm -it -p 5000:5000 macrostrat-api",
"serve": "ts-node --transpileOnly server.ts",
"test": "mocha ./v2",
Expand Down
24 changes: 22 additions & 2 deletions v2/larkin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,18 @@ const { Client, Pool } = require("pg");
// Macrostrat refs
if (key === "refs" || key === "ref_id") {
larkin.queryPg("burwell",
"SELECT refs.id AS ref_id, pub_year, author, ref, doi, url, COUNT(DISTINCT units_sections.unit_id) AS t_units FROM macrostrat.refs LEFT JOIN macrostrat.col_refs ON col_refs.ref_id = refs.id LEFT JOIN macrostrat.units_sections ON units_sections.col_id = col_refs.col_id WHERE refs.id = ANY(:ref_id) GROUP BY refs.id",
`SELECT refs.id AS ref_id,
pub_year,
author,
ref,
doi,
url,
COUNT(DISTINCT units_sections.unit_id) AS t_units
FROM macrostrat.refs
LEFT JOIN macrostrat.col_refs ON col_refs.ref_id = refs.id
LEFT JOIN macrostrat.units_sections ON units_sections.col_id = col_refs.col_id
WHERE refs.id = ANY (:ref_id)
GROUP BY refs.id, pub_year, author, ref, doi, url`,
{ ref_id: ref_ids },
function (error, data) {
var refs = {};
Expand All @@ -596,7 +607,16 @@ const { Client, Pool } = require("pg");
} else {
larkin.queryPg(
"burwell",
"SELECT source_id, name, COALESCE(url, '') url, COALESCE(ref_title, '') ref_title, COALESCE(authors, '') authors, COALESCE(ref_year, '') ref_year, COALESCE(ref_source, '') ref_source, COALESCE(isbn_doi, '') isbn_doi FROM maps.sources WHERE source_id = ANY($1)",
`SELECT source_id,
name,
COALESCE(url, '') url,
COALESCE(ref_title, '') ref_title,
COALESCE(authors, '') authors,
COALESCE(ref_year, '') ref_year,
COALESCE(ref_source, '') ref_source,
COALESCE(isbn_doi, '') isbn_doi
FROM maps.sources
WHERE source_id = ANY ($1)`,
[ref_ids],
function (error, result) {
var refs = {};
Expand Down
Loading