You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my environment, the auto_reload_from_file feature (#1029) is not working.
(When I update a file directly in the editor, the changes are not reflected in the notebook.)
I think it was working in my environment at the time of e3451b1.
My environment is as follows.
Pluto v0.17.1
Julia v1.6.1
Xubuntu Linux 18.04.6
vim 8.2
After checking the source code, it seems that there is a problem with the add() function in SessionActions.jl.
# @info "Notebook was saved by me very recently, not reloading from file."
if modified_time - nb.last_save_time < session.options.server.auto_reload_from_file_cooldown
# @info "Modified time is very close to my last save time, not reloading from file."
else
update_from_file_throttled()
end
end
end
in_session() =get(session.notebooks, nb.notebook_id, nothing) === nb
session.options.server.auto_reload_from_file &&@asynclogwhilein_session()
if!isfile(nb.path) ### (4)# notebook file deleted... let's ignore this, changing the notebook will cause it to save again. Fine for nowsleep(2)
elsewatch_file(nb.path) ### (1)# the above call is blocking until the file changes# current_time = time()
modified_time =mtime(nb.path) ### (2)# @info "File changed" (current_time - nb.last_save_time) (modified_time - nb.last_save_time) (current_time - modified_time)if!in_session()
breakend# if current_time - nb.last_save_time < 2.0# @info "Notebook was saved by me very recently, not reloading from file."if modified_time - nb.last_save_time < session.options.server.auto_reload_from_file_cooldown ### (3)# @info "Modified time is very close to my last save time, not reloading from file."elseupdate_from_file_throttled()
endendend
I inserted the @info macro and did a print debug, and found the following.
For the lines in comments (1)-(4) above,
When a file is updated directly, the return value of watch_file(nb.path) (FileWatching.FileEvent) will be renamed=true instead of changed=true.
Immediately after that, the value of modified_time is 0.
Go to the first branch and update_from_file_throttled() will not be executed.
Immediately after these, isfile(nb.path) == false.
I inserted the following lines after modified_time = mtime(nb.path), and it works fine for now.
if modified_time ==0sleep(1)
modified_time =mtime(nb.path)
end
The text was updated successfully, but these errors were encountered:
In my environment, the
auto_reload_from_file
feature (#1029) is not working.(When I update a file directly in the editor, the changes are not reflected in the notebook.)
I think it was working in my environment at the time of e3451b1.
My environment is as follows.
After checking the source code, it seems that there is a problem with the
add()
function inSessionActions.jl
.Pluto.jl/src/webserver/SessionActions.jl
Lines 86 to 110 in 656407d
I inserted the
@info
macro and did a print debug, and found the following.For the lines in comments (1)-(4) above,
watch_file(nb.path)
(FileWatching.FileEvent
) will berenamed=true
instead ofchanged=true
.modified_time
is 0.update_from_file_throttled()
will not be executed.isfile(nb.path) == false
.I inserted the following lines after
modified_time = mtime(nb.path)
, and it works fine for now.The text was updated successfully, but these errors were encountered: