reduced logging
This commit is contained in:
parent
e24be625d1
commit
8ce984151b
|
@ -66,7 +66,6 @@ export class Collection {
|
||||||
eventType = 'create';
|
eventType = 'create';
|
||||||
}
|
}
|
||||||
const deltaBulider = new EntityPropertiesDeltaBuilder(entityId);
|
const deltaBulider = new EntityPropertiesDeltaBuilder(entityId);
|
||||||
console.log('deltaBulider -->', deltaBulider.delta);
|
|
||||||
|
|
||||||
if (!properties) {
|
if (!properties) {
|
||||||
// Let's interpret this as entity deletion
|
// Let's interpret this as entity deletion
|
||||||
|
@ -125,7 +124,6 @@ export class Collection {
|
||||||
|
|
||||||
applyDelta(delta: Delta) {
|
applyDelta(delta: Delta) {
|
||||||
// TODO: handle delta representing entity deletion
|
// TODO: handle delta representing entity deletion
|
||||||
console.log('applying delta:', delta);
|
|
||||||
const idPtr = delta.pointers.find(({localContext}) => localContext === 'id');
|
const idPtr = delta.pointers.find(({localContext}) => localContext === 'id');
|
||||||
if (!idPtr) {
|
if (!idPtr) {
|
||||||
console.error('encountered delta with no entity id', delta);
|
console.error('encountered delta with no entity id', delta);
|
||||||
|
|
|
@ -47,9 +47,7 @@ class Users {
|
||||||
}
|
}
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
console.log('1');
|
|
||||||
const users = new Users();
|
const users = new Users();
|
||||||
console.log('2');
|
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
app.get("/ids", (req: express.Request, res: express.Response) => {
|
app.get("/ids", (req: express.Request, res: express.Response) => {
|
||||||
|
@ -94,11 +92,8 @@ class Users {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('3');
|
|
||||||
await bindPublish();
|
await bindPublish();
|
||||||
console.log('3a');
|
|
||||||
await bindReply();
|
await bindReply();
|
||||||
console.log('3b');
|
|
||||||
runDeltas();
|
runDeltas();
|
||||||
runRequestHandlers();
|
runRequestHandlers();
|
||||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||||
|
@ -107,7 +102,6 @@ class Users {
|
||||||
askAllPeersForDeltas();
|
askAllPeersForDeltas();
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
|
||||||
console.log('4');
|
|
||||||
const taliesin = users.upsert({
|
const taliesin = users.upsert({
|
||||||
// id: 'taliesin-1',
|
// id: 'taliesin-1',
|
||||||
name: 'Taliesin',
|
name: 'Taliesin',
|
||||||
|
|
|
@ -80,13 +80,11 @@ export async function askAllPeersForDeltas() {
|
||||||
peers.forEach(async (peer, idx) => {
|
peers.forEach(async (peer, idx) => {
|
||||||
console.log(`Asking peer ${idx} for deltas`);
|
console.log(`Asking peer ${idx} for deltas`);
|
||||||
const deltas = await peer.askForDeltas();
|
const deltas = await peer.askForDeltas();
|
||||||
console.log('received deltas:', deltas);
|
console.log(`received ${deltas.length}`);
|
||||||
for (const delta of deltas) {
|
for (const delta of deltas) {
|
||||||
delta.receivedFrom = peer.reqAddr;
|
delta.receivedFrom = peer.reqAddr;
|
||||||
receiveDelta(delta);
|
receiveDelta(delta);
|
||||||
}
|
}
|
||||||
console.log('deltasProposed count', deltasProposed.length);
|
|
||||||
console.log('deltasAccepted count', deltasAccepted.length);
|
|
||||||
ingestAll();
|
ingestAll();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ export const subscribeSock = new Subscriber();
|
||||||
|
|
||||||
export async function bindPublish() {
|
export async function bindPublish() {
|
||||||
const addrStr = `tcp://${PUBLISH_BIND_ADDR}:${PUBLISH_BIND_PORT}`;
|
const addrStr = `tcp://${PUBLISH_BIND_ADDR}:${PUBLISH_BIND_PORT}`;
|
||||||
console.log('addrStr:', addrStr);
|
|
||||||
await publishSock.bind(addrStr);
|
await publishSock.bind(addrStr);
|
||||||
console.log(`Publishing socket bound to ${addrStr}`);
|
console.log(`Publishing socket bound to ${addrStr}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue