Commit daafd51b by Jun Matsushita

Rename informationDb into configDb

parent 75e00b6e
Pipeline #1553 passed with stages
in 4 minutes 0 seconds
......@@ -20,8 +20,8 @@ config-contradiction-push-config:
- npm
- run
- pushdocs
- http://couchdb:5984/config-contradictions-$DEPLOY_STAGE
- docs/config-contradictions-$DEPLOY_STAGE/
- http://couchdb:5984/config-$DEPLOY_STAGE
- docs/dependencies_last_seen.json
links:
- couchdb
......
......@@ -102,7 +102,7 @@ function applyCommand(db, cmd, aggregate) {
}
// Analyse 'merge' DB last change and fetch newly created commands
async function onUpdate(db, contradictionsDb, informationDb, error, change, feed, aggregate) {
async function onUpdate(db, contradictionsDb, configDb, error, change, feed, aggregate) {
try {
// blocks events, this allow to have synchronous handling of
// the updates, which makes everything easier
......@@ -116,7 +116,7 @@ async function onUpdate(db, contradictionsDb, informationDb, error, change, feed
}
console.log('change ', change);
try {
let {etag, rev, doc_exists} = await getLastSeenDoc(informationDb, aggregate);
let {etag, rev, doc_exists} = await getLastSeenDoc(configDb, aggregate);
let fetched = await fetchCommands(change, db);
let message = await fetched.json();
let contentEtag = JSON.parse(fetched.headers.get('etag'));
......@@ -131,7 +131,7 @@ async function onUpdate(db, contradictionsDb, informationDb, error, change, feed
applyCommand(contradictionsDb, message.commands[idx], aggregate);
}
}
await updateOrCreate(informationDb, doc_exists, rev, contentEtag, change.seq, aggregate);
await updateOrCreate(configDb, doc_exists, rev, contentEtag, change.seq, aggregate);
} catch(err) {
console.log('Catched error ', err);
}
......@@ -145,12 +145,12 @@ async function followMergeDb(config) {
const dbUrl = config.couchdb + '/' + config.mergeDb;
const db = new PouchDB(dbUrl);
const contradictionsDb = new PouchDB(config.couchdb + '/' + config.contradictionsDb);
const informationDb = new PouchDB(config.couchdb + '/' + config.informationDb);
const configDb = new PouchDB(config.couchdb + '/' + config.configDb);
console.log(' db ', db.getUrl());
console.log(' contradictionsDb ', contradictionsDb.getUrl())
console.log(' informationDb ', informationDb.getUrl())
console.log(' configDb ', configDb.getUrl())
try {
let {last_seq} = await getLastSeenDoc(informationDb, config.aggregate);
let {last_seq} = await getLastSeenDoc(configDb, config.aggregate);
console.log(config.aggregate + '_last_seq ', last_seq);
follow({db: dbUrl,
include_docs:true,
......@@ -158,7 +158,7 @@ async function followMergeDb(config) {
since: last_seq
}, function(error, change) {
let feed = this;
onUpdate(db, contradictionsDb, informationDb, error, change, feed, config.aggregate);
onUpdate(db, contradictionsDb, configDb, error, change, feed, config.aggregate);
});
} catch(err) {
console.log('Err ', err);
......@@ -180,9 +180,9 @@ async function onReady() {
contradictionsDb: process.env.contradiction_AGGREGATE
? 'contradictions-' + process.env.contradiction_AGGREGATE
: 'contradictions-dependencies-local',
informationDb: process.env.contradiction_CONFIGDB
configDb: process.env.contradiction_CONFIGDB
? process.env.contradiction_CONFIGDB
: 'config-contradictions-local'
: 'config-local'
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment