Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Objects with long bodies don't fit into DelayedJob "handler" field #551

Open
brchristian opened this issue Jul 24, 2013 · 7 comments
Open

Comments

@brchristian
Copy link

I'm following the instructions at http://railscasts.com/episodes/314-pretty-urls-with-friendlyid?view=asciicast and coming up with some problems trying to execute the Article.find_each(&:save) command.

Specifically, what appears to be happening is that the entire object to be saved is being included in the handler field of my delayed_jobs table. For 99% of my objects, this isn't a problem. But I have one particularly long article, that just won't save.

Any ideas what might be going on here?

INSERT INTO delayed_jobs (attempts, created_at, failed_at, handler, last_error, locked_at, locked_by, priority, queue, run_at, updated_at) VALUES (0, '2013-07-24 17:02:07', NULL, '--- !ruby/object:Delayed::PerformableMethod\nobject: !ruby/ActiveRecord:Article\n attributes:\n id: 315\n title: My Article Title.\n cached_slug: \n body: ! " ........super super long body text redacted here......................................................" \n is_visible: 1\n publish_in_app: 0\n publish_date: 2008-09-27 19:27:00.000000000 Z\n created_at: 2010-10-06 20:31:10.000000000 Z\n updated_at: 2013-07-24 17:02:07.813279000 Z\n column_id: 2\n column_width: 400\n was_updated: false\n hit_count: 0\n edited_at: 2011-06-23 18:45:06.000000000 Z\n slug: my-article\nmethod_name: :solr_index_without_delay\nargs: []\n', NULL, NULL, NULL, 0, NULL, '2013-07-24 17:02:07', '2013-07-24 17:02:07')

(1.0ms)  ROLLBACK

ActiveRecord::StatementInvalid: Mysql2::Error: Data too long for column 'handler' at row 1
@RKushnir
Copy link

Just don't put objects into queue when all you need is an id.

@samnissen
Copy link

+1

@bobzhang199102
Copy link

@RKushnir what is the alternative way?

@RKushnir
Copy link

@bobzhang199102 Pass id to the worker, in the worker retrieve record from the database by the id.

@bobzhang199102
Copy link

@RKushnir , what if the object does not have id?

@RKushnir
Copy link

@bobzhang199102 Then you do need to pass the object itself.

@bobzhang199102
Copy link

@RKushnir The delayed_job add jobs in the database and remove if without errors. But The job has not been done. Nothing printout even though I put a print in the block no request has been made. Do you know why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants