rails: delayed-job progress bar -
i trying show user progress bar task running in delayed job. populating large amount of data using delayed job in database this.
class importschoolsanddistricts < struct.new(:import, :content) def perform total = content.size content.each_with_index |record,index| # create records here import.update_attribute(:progress, (index + 1)/total*100) end end end
end
:import
instance of import model attribute progress
. use progress
attribute display user status of job percentage.
but update of progress
not occurring continuously. updating twice: once @ beginning , once @ end, values getting progress 0% , 100%.
since using ruby 1.9, cannot use progress_bar https://github.com/d4be4st/progress_job (requires ruby 2.0.0)
Comments
Post a Comment