Deploy and schema updates for testing

This commit is contained in:
Max committed 2026-11-03 11:48:06 -07:00
1 parent 8d60aae65c
commit 81b4162117
8 files changed
+389 -86

No files matched your search

+25 -7
View File
@@ -348,16 +348,34 @@ app.use('/api/metric-tracking', metricTracking)
//
// Scraper startup.
//
// ensureScrapeSchema() converges the scrape_cache table and the attachment
// lifecycle columns. It is idempotent and runs before the listener binds, so
// there is no window where requests arrive against a schema that is mid-change.
// There is no migration framework in this project - see server/helpers/Schema.js.
// The application deliberately holds no DDL privileges, so it does not create
// its own schema - verifyScrapeSchema() only checks that an admin has already
// run ./applyScrapeSchema.sh and that the required DML grants are present.
//
// When anything is missing the scraper stays off rather than failing an INSERT
// on every note save. The listener binds either way: the API must not depend on
// link previews being available.
//
const Schema = require('@helpers/Schema')
const ScrapeQueue = require('@workers/ScrapeQueue')
Schema.ensureScrapeSchema()
.then(() => {
Schema.verifyScrapeSchema()
.then(result => {
if (!result.ok) {
const missing = [
...result.missingObjects,
...result.missingPrivileges.map(privilege => `privilege ${privilege}`),
].join(', ')
console.log(`Scraper: DISABLED - missing ${missing}. To fix: ${result.remedy}`)
return null
}
// Say so positively. Previously a healthy scraper logged nothing, so
// "started" and "silently disabled" looked identical in pm2 logs --
// which is how a dead scraper went unnoticed on production.
console.log('Scraper: ready')
ScrapeQueue.start()
// The queue lives in memory, so a pm2 reload loses whatever was in it.
@@ -372,7 +390,7 @@ Schema.ensureScrapeSchema()
})
.catch(error => {
// A scraper that cannot start must not stop the API from serving.
console.log('Scraper: startup failed, link previews disabled this boot:', error.message)
console.log('Scraper: startup check failed, link previews disabled this boot:', error.message)
})
.finally(() => {
//Output running status