Skip to content

Development mode timestamp-based autocompilation #302

Open
ztmr opened this Issue Jul 20, 2013 · 1 comment

4 participants

@ztmr
ztmr commented Jul 20, 2013

CB started to report the following error recently:

18:39:32.543 [error] {{badmatch,false},[{boss_load,module_older_than,2,[{file,"src/boss/boss_load.erl"},{line,375}]},{boss_load,load_view_if_old,5,[{file,"src/boss/boss_load.erl"},{line,304}]},{boss_load,load_view_if_dev,4,[{file,"src/boss/boss_load.erl"},{line,325}]},{lists,foldl,3,[{file,"lists.erl"},{line,1197}]},{boss_web_controller,render_view,6,[{file,"src/boss/boss_web_controller.erl"},{line,1032}]},{boss_web_controller,execute_action1,8,[{file,"src/boss/boss_web_controller.erl"},{line,893}]},{boss_web_controller,execute_action,5,[{file,"src/boss/boss_web_controller.erl"},{line,839}]},{boss_web_controller,process_dynamic_request,4,[{file,"src/boss/boss_web_controller.erl"},{line,540}]}]}

The problem appears in environment where more than one CB web application is loaded and it does only to the "developing application" while all the other apps worked fine.

Doing boss_load:reload_all () by hand will fix it sometimes, but only until the last change/rebuild.

Also, when I took a look at the code, I found another noticeable thing -- the time of compilation of the BEAM file is retrieved using filelib:last_modified/1 which from our experience may not work properly because it uses filesystem (local) time without care about timezone. I am not sure if you compare the filesystem time with time property of Module:module_info (compile), but I'd rather use a function like this:

last_modified (File) ->
  case file:read_file_info (File, [{time, universal}]) of
      {error, _}                   -> 0;
      {ok, #file_info {mtime = X}} -> X
  end.

Just my 2 cents :)

@zkessin zkessin was assigned Jan 7, 2014
@mihawk
mihawk commented Jan 30, 2015

maybe fixed with the PR #533

@zkessin zkessin was unassigned by danikp Oct 15, 2015
@danikp danikp added the loading label Oct 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.