changeset 2322:cdfd2901918a

logging
author drewp@bigasterisk.com
date Thu, 01 Jun 2023 14:21:20 -0700
parents ed0db55f604c
children 855f1abf5c66
files light9/web/RdfDbChannel.ts light9/web/SyncedGraph.ts light9/web/patch.ts light9/web/rdfdbclient.ts
diffstat 4 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/light9/web/RdfDbChannel.ts	Thu Jun 01 14:20:40 2023 -0700
+++ b/light9/web/RdfDbChannel.ts	Thu Jun 01 14:21:20 2023 -0700
@@ -57,9 +57,9 @@
     return true;
   }
 
-  disconnect() {
+  disconnect(why:string) {
     // will be followed by an autoconnect
-    log("disconnect requested");
+    log("disconnect requested:", why);
     if (this.ws !== undefined) {
       const closeHandler = this.ws.onclose?.bind(this.ws);
       if (!closeHandler) {
@@ -123,7 +123,7 @@
 
   private onWsError(e: Event) {
     log("ws error", e);
-    this.disconnect();
+    this.disconnect("ws error");
     this.updateStatus();
   }
 
--- a/light9/web/SyncedGraph.ts	Thu Jun 01 14:20:40 2023 -0700
+++ b/light9/web/SyncedGraph.ts	Thu Jun 01 14:21:20 2023 -0700
@@ -38,7 +38,7 @@
     this.autoDeps = new AutoDependencies(this);
     this.autoDeps.graphError.subscribe((e) => {
       log("graph learned of error - reconnecting", e);
-      this.client.disconnect();
+      this.client.disconnect("graph error");
     });
     this.clearGraph();
 
--- a/light9/web/patch.ts	Thu Jun 01 14:20:40 2023 -0700
+++ b/light9/web/patch.ts	Thu Jun 01 14:21:20 2023 -0700
@@ -77,6 +77,9 @@
   }
 
   dump(): string {
+    if (this.dels.size + this.adds.size > 20) {
+      return this.summary();
+    }
     const lines: string[] = [];
     const s = (term: N3.Term): string => {
       if (term.termType == "Literal") return term.value;
--- a/light9/web/rdfdbclient.ts	Thu Jun 01 14:20:40 2023 -0700
+++ b/light9/web/rdfdbclient.ts	Thu Jun 01 14:21:20 2023 -0700
@@ -44,8 +44,8 @@
     this._continueSending();
   }
 
-  disconnect() {
-    this.channel.disconnect();
+  disconnect(why:string) {
+    this.channel.disconnect(why);
   }
 
   async _continueSending() {