Skip to content

Commit

Permalink
Merge pull request #237 from UW-Macrostrat/fix-zombie-process
Browse files Browse the repository at this point in the history
Fix zombie process
  • Loading branch information
davenquinn authored Sep 21, 2024
2 parents 5e99d61 + 9d924dd commit ecb870d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
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

0 comments on commit ecb870d

Please sign in to comment.