Skip to content

Commit

Permalink
remove logs
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Aug 11, 2024
1 parent f532c18 commit 0f45c19
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/webserver/Dynamic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,7 @@ Update the local state of all clients connected to this notebook.
function send_notebook_changes!(πŸ™‹::ClientRequest; commentary::Any=nothing, skip_send::Bool=false, should_lock::Bool=true)
outbox = Set{Tuple{ClientSession,UpdateMessage}}()

@debug "y1" should_lock

(should_lock ? Base.acquire : dontacquire)(current_state_for_clients_lock) do
@debug "y2" should_lock
notebook_dict = notebook_to_js(πŸ™‹.notebook)
for (_, client) in πŸ™‹.session.connected_clients
if client.connected_notebook !== nothing && client.connected_notebook.notebook_id == πŸ™‹.notebook.notebook_id
Expand Down Expand Up @@ -296,9 +293,7 @@ const effects_of_changed_state = Dict(
responses[:update_notebook] = function response_update_notebook(πŸ™‹::ClientRequest)
require_notebook(πŸ™‹)
try
@debug "x1"
Base.acquire(current_state_for_clients_lock)
@debug "x2"
notebook = πŸ™‹.notebook
patches = (Base.convert(Firebasey.JSONPatch, update) for update in πŸ™‹.body["updates"])

Expand All @@ -312,13 +307,11 @@ responses[:update_notebook] = function response_update_notebook(πŸ™‹::ClientRequ
if !haskey(current_state_for_clients, πŸ™‹.initiator.client)
throw(ErrorException("Updating without having a first version of the notebook??"))
end
@debug "x2a"

# TODO Immutable ??
for patch in patches
Firebasey.applypatch!(current_state_for_clients[πŸ™‹.initiator.client], patch)
end
@debug "x2b"

changes = Set{Changed}()

Expand All @@ -333,7 +326,6 @@ responses[:update_notebook] = function response_update_notebook(πŸ™‹::ClientRequ

union!(changes, current_changes)
end
@debug "x2c"

# We put a flag to check whether any patch changes the skip_as_script metadata. This is to eventually trigger a notebook updated if no reactive_run is part of this update
skip_as_script_changed = any(patches) do patch
Expand All @@ -346,7 +338,6 @@ responses[:update_notebook] = function response_update_notebook(πŸ™‹::ClientRequ
end
end

@debug "x2d"
# If CodeChanged ∈ changes, then the client will also send a request like run_multiple_cells, which will trigger a file save _before_ running the cells.
# In the future, we should get rid of that request, and save the file here. For now, we don't save the file here, to prevent unnecessary file IO.
# (You can put a log in save_notebook to track how often the file is saved)
Expand All @@ -357,7 +348,6 @@ responses[:update_notebook] = function response_update_notebook(πŸ™‹::ClientRequ
end
save_notebook(πŸ™‹.session, notebook)
end
@debug "x2e"

let bond_changes = filter(x -> x isa BondChanged, changes)
bound_sym_names = Symbol[x.bond_name for x in bond_changes]
Expand All @@ -373,7 +363,6 @@ responses[:update_notebook] = function response_update_notebook(πŸ™‹::ClientRequ
end

send_notebook_changes!(πŸ™‹; commentary=Dict(:update_went_well => :πŸ‘), should_lock=false)
@debug "x2g"
catch ex
@error "Update notebook failed" πŸ™‹.body["updates"] exception=(ex, stacktrace(catch_backtrace()))
response = Dict(
Expand All @@ -383,7 +372,6 @@ responses[:update_notebook] = function response_update_notebook(πŸ™‹::ClientRequ
)
send_notebook_changes!(πŸ™‹; commentary=response, should_lock=false)
finally
@debug "x3"
Base.release(current_state_for_clients_lock)
end
end
Expand Down

0 comments on commit 0f45c19

Please sign in to comment.