@nxtedition/lib 17.2.15 → 17.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.js +2 -2
- package/couch.js +11 -0
- package/http.js +1 -1
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -185,7 +185,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
185
185
|
setTimeout(() => {
|
|
186
186
|
logger.error('aborting')
|
|
187
187
|
if (isMainThread) {
|
|
188
|
-
process.
|
|
188
|
+
process.exit(1)
|
|
189
189
|
} else {
|
|
190
190
|
// TODO (fix): What to do here?
|
|
191
191
|
}
|
|
@@ -463,7 +463,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
463
463
|
? rxjs.timer(0, 10e3).pipe(
|
|
464
464
|
rx.exhaustMap(async () => {
|
|
465
465
|
try {
|
|
466
|
-
await couch.
|
|
466
|
+
await couch.up()
|
|
467
467
|
} catch (err) {
|
|
468
468
|
return [
|
|
469
469
|
{
|
package/couch.js
CHANGED
|
@@ -116,6 +116,7 @@ export function makeCouch(opts) {
|
|
|
116
116
|
body: req.body ? JSON.stringify(req.body).slice(0, 4096) : null,
|
|
117
117
|
data: {
|
|
118
118
|
req: {
|
|
119
|
+
origin: dbOrigin,
|
|
119
120
|
path,
|
|
120
121
|
method: req.method,
|
|
121
122
|
headers: req.headers,
|
|
@@ -790,6 +791,15 @@ export function makeCouch(opts) {
|
|
|
790
791
|
return res.data
|
|
791
792
|
}
|
|
792
793
|
|
|
794
|
+
async function up(params, body, { client = defaultClient, signal } = {}) {
|
|
795
|
+
const res = await client.request({
|
|
796
|
+
path: '/_up',
|
|
797
|
+
method: 'GET',
|
|
798
|
+
signal,
|
|
799
|
+
throwOnError: true,
|
|
800
|
+
})
|
|
801
|
+
return await res.body.json()
|
|
802
|
+
}
|
|
793
803
|
async function upsert(pathname, diffFun, { client, signal } = {}) {
|
|
794
804
|
while (true) {
|
|
795
805
|
let doc
|
|
@@ -847,5 +857,6 @@ export function makeCouch(opts) {
|
|
|
847
857
|
info,
|
|
848
858
|
changes,
|
|
849
859
|
close,
|
|
860
|
+
up,
|
|
850
861
|
}
|
|
851
862
|
}
|
package/http.js
CHANGED
|
@@ -48,7 +48,7 @@ export async function request(ctx, next) {
|
|
|
48
48
|
|
|
49
49
|
res.setHeader('request-id', req.id)
|
|
50
50
|
|
|
51
|
-
const isHealthcheck = ctx.url.pathname === '/healthcheck'
|
|
51
|
+
const isHealthcheck = ctx.url.pathname === '/healthcheck' || ctx.url.pathname === '/_up'
|
|
52
52
|
|
|
53
53
|
reqLogger = logger.child({ req })
|
|
54
54
|
if (!isHealthcheck) {
|