socialpandas / sidekiq_monitor

Advanced monitoring for Sidekiq
MIT License
230 stars 35 forks source link

Sometimes the call for jobs data, returns malformed info. #38

Open AlexandruCD opened 9 years ago

AlexandruCD commented 9 years ago

Happens often that when I run some jobs, they are executed successfully by sidekiq but the response from calling 'api/jobs' is broken. That leads to a jQuery error(cannot read property length of undefined). The response, instead of being a valid json, is a string like it: "#Sidekiq::Monitor::JobsDatatable:0x0000000eab2990" Restarting the rails server fixes it. At the runtime, neither of deleting rows from mysql or keys from redis don't help.

AlexandruCD commented 9 years ago

Seems like the problem is here. Sometimes after certain jobs get executed, when this is getting called render json: JobsDatatable.new(view_context) It no longer goes through as_json from RailsDatatable gem. It goes through the class initialize method, but for some reason, it does'nt go after into as_json.

AlexandruCD commented 9 years ago

After a lot of research, i found that in one of my models i have something like that require 'json/pure' Everytime i make a query for its associated table, or make use of the model, this seems like is overwriting the sidekiq-monitor as_json definition it inherits from railsdatatable. Any solution for this?