Note that there are some explanatory texts on larger screens.

plurals
  1. POdelayed_job 3.0.0 works in console but not WEBrick
    primarykey
    data
    text
    <p>Environment:</p> <pre><code> Rails =&gt; 3.1.0 delayed_job =&gt; 3.0.1 delayed_job_active_record =&gt; 0.3.1 WEBrick =&gt; 1.3.1 ruby =&gt; 1.9.2 </code></pre> <p>Code:</p> <pre><code>class Comment &lt; ActiveRecord::Base def tweet(tweet_msg) client = Twitter::Client.new client.update(tweet_msg) end after_save :tweet_comment def tweet_comment self.delay.tweet('test tweet') end end </code></pre> <p>Console:</p> <p>From the console I get the following inserted into the delayed_jobs table and the tweet_as_site function gets called. Everything works fine....</p> <pre><code> SQL (0.5ms) INSERT INTO `delayed_jobs` (`attempts`, `created_at`, `failed_at`, `handler`, `last_error`, `locked_at`, `locked_by`, `priority`, `queue`, `run_at`, `updated_at`) VALUES (0, '2012-01-25 21:21:48', NULL, '--- !ruby/object:Delayed::PerformableMethod\nobject: !ruby/ActiveRecord:Comment\n attributes:\n id: 121\n title: \'\'\n comment: aa\n commentable_id: 2296\n commentable_type: Game\n user_id: 1\n created_at: 2012-01-25 21:19:19.000000000Z\n updated_at: 2012-01-25 21:19:19.000000000Z\nmethod_name: :tweet\nargs:\n- test tweet\n', NULL, NULL, NULL, 0, NULL, '2012-01-25 21:21:48', '2012-01-25 21:21:48') Log: 2012-01-25T13:21:52-0800: [Worker(delayed_job host:ubuntu pid:13063)] Comment#tweet completed after 1.6850 2012-01-25T13:21:52-0800: [Worker(delayed_job host:ubuntu pid:13063)] 1 jobs processed at 0.5913 j/s, 0 failed ... </code></pre> <p>Then when I do this through the WEBrick webserver, the following sql gets inserted into the delayed_jobs table...</p> <pre><code> SQL (0.4ms) INSERT INTO `delayed_jobs` (`attempts`, `created_at`, `failed_at`, `handler`, `last_error`, `locked_at`, `locked_by`, `priority`, `queue`, `run_at`, `updated_at`) VALUES (0, '2012-01-25 21:19:19', NULL, '--- !ruby/object:Delayed::PerformableMethod\nattributes:\n id: 121\n title: \'\'\n comment: aa\n commentable_id: 2296\n commentable_type: Game\n user_id: 1\n created_at: 2012-01-25 21:19:19.759253106Z\n updated_at: 2012-01-25 21:19:19.759253106Z\n', NULL, NULL, NULL, 0, NULL, '2012-01-25 21:19:19', '2012-01-25 21:19:19') Log: 2012-01-25T13:19:20-0800: [Worker(delayed_job host:ubuntu pid:13063)] NilClass# completed after 0.0083 2012-01-25T13:19:20-0800: [Worker(delayed_job host:ubuntu pid:13063)] 1 jobs processed at 55.5559 j/s, 0 failed ... </code></pre> <p>The insert from the console includes "method_name: :tweet\nargs:\n- test tweet" in the handler yaml, but that part is missing when executed from WEBrick.</p> <p>Some notes...</p> <ol> <li>I've tried this with both .delay as well as handle_asynchronously but neither work.</li> <li>It does work with WEBrick for some objects, such as the Twitter::Client, but it doesn't work with my own models.</li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload