cleanup logs

pull/19/head
Niko PLP 8 months ago
parent 5460a22737
commit 3e4c2a70dc
  1. 2
      ng-app/src-tauri/src/lib.rs
  2. 6
      ng-app/src/lib/Test.svelte
  3. 14
      ng-app/src/store.ts
  4. 2
      ng-sdk-js/src/lib.rs
  5. 4
      ng-verifier/src/request_processor.rs
  6. 20
      ng-verifier/src/verifier.rs

@ -269,7 +269,7 @@ async fn app_request_stream(
.await
.map_err(|e| e.to_string())?;
log_debug!("END OF LOOP");
//log_debug!("END OF LOOP");
Ok(())
}

@ -259,11 +259,11 @@
{:then}
{#each $files as file}
<p>
{file.V0.File.name}<br />
did:ng{file.V0.File.nuri}
{file.V0.File.name}
{#await get_img(file.V0.File) then url}
{#if url}
<img src={url} />
<img src={url} title={"did:ng" + file.V0.File.nuri} />
{/if}
{/await}
</p>

@ -174,11 +174,11 @@ export const branch_subs = function(nura) {
return {
load: async () => {
console.log("load upper");
//console.log("load upper");
let already_subscribed = all_branches[nura];
if (!already_subscribed) return;
if (already_subscribed.load) {
console.log("doing the load");
//console.log("doing the load");
let loader = already_subscribed.load;
already_subscribed.load = undefined;
// already_subscribed.load2 = loader;
@ -195,7 +195,7 @@ export const branch_subs = function(nura) {
already_subscribed = {
load: async () => {
try {
console.log("load down");
//console.log("load down");
let session = get(active_session);
if (!session) {
console.error("no session");
@ -206,7 +206,7 @@ export const branch_subs = function(nura) {
set([]);
unsub = await ng.app_request_stream(session.session_id, await ng.doc_fetch_private_subscribe(),
async (commit) => {
console.log("GOT APP RESPONSE", commit);
//console.log("GOT APP RESPONSE", commit);
update( (old) => {old.unshift(commit); return old;} )
});
}
@ -218,12 +218,12 @@ export const branch_subs = function(nura) {
},
increase: () => {
count += 1;
console.log("increase sub to",count);
//console.log("increase sub to",count);
return readonly({subscribe});
},
decrease: () => {
count -= 1;
console.log("decrease sub to",count);
//console.log("decrease sub to",count);
// if (count == 0) {
// unsub();
// console.log("removed sub");
@ -238,7 +238,7 @@ export const branch_subs = function(nura) {
let read_unsub = new_store.subscribe(run, invalid);
return () => {
read_unsub();
console.log("callback unsub");
//console.log("callback unsub");
already_subscribed.decrease();
}

@ -537,7 +537,7 @@ pub async fn app_request_stream(
}
}
}
log_info!("END OF LOOP");
//log_info!("END OF LOOP");
Ok(())
}

@ -41,9 +41,7 @@ impl AppRequestCommandV0 {
AppFetchContentV0::Subscribe => {
let (_, branch_id, _) =
Self::open_for_target(verifier, &nuri.target, false).await?;
Ok(verifier
.create_branch_subscription(branch_id, false)
.await?)
Ok(verifier.create_branch_subscription(branch_id).await?)
}
_ => unimplemented!(),
},

@ -154,11 +154,11 @@ impl Verifier {
}
pub(crate) async fn push_app_response(&mut self, branch: &BranchId, response: AppResponse) {
log_info!(
"push_app_response {} {:?}",
branch,
self.branch_subscriptions
);
// log_info!(
// "push_app_response {} {:?}",
// branch,
// self.branch_subscriptions
// );
if let Some(sender) = self.branch_subscriptions.get_mut(branch) {
if sender.is_closed() {
log_info!("closed so removed");
@ -172,7 +172,6 @@ impl Verifier {
pub(crate) async fn create_branch_subscription(
&mut self,
branch: BranchId,
resub: bool,
) -> Result<(Receiver<AppResponse>, CancelFn), VerifierError> {
// async fn send(mut tx: Sender<AppResponse>, msg: AppResponse) -> ResultSend<()> {
// while let Ok(_) = tx.send(msg.clone()).await {
@ -185,16 +184,16 @@ impl Verifier {
// spawn_and_log_error(send(tx.clone(), commit));
//log_info!("#### create_branch_subscription {}", branch);
let (tx, rx) = mpsc::unbounded::<AppResponse>();
log_info!("SUBSCRIBE");
//log_info!("SUBSCRIBE");
if let Some(returned) = self.branch_subscriptions.insert(branch, tx.clone()) {
log_info!("RESUBSCRIBE");
//log_info!("RESUBSCRIBE");
if !returned.is_closed() {
log_info!("FORCE CLOSE");
//log_info!("FORCE CLOSE");
returned.close_channel();
//return Err(VerifierError::DoubleBranchSubscription);
}
}
if !resub {
//let tx = self.branch_subscriptions.entry(branch).or_insert_with(|| {});
for file in self
.user_storage
@ -205,7 +204,6 @@ impl Verifier {
self.push_app_response(&branch, AppResponse::V0(AppResponseV0::File(file)))
.await;
}
}
let fnonce = Box::new(move || {
log_info!("CLOSE_CHANNEL");

Loading…
Cancel
Save