Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Issue With delayed_job, Heroku, & Timestamp Format #470

Closed
shawndeprey opened this Issue · 5 comments

2 participants

Shawn Deprey David Genord II
Shawn Deprey

I am trying to get my rails server up on Heroku, and, I ran into a fun error I am currently unable to resolve. The following error is throwing when I try to run my delayed job task. Let me know if it is an issue before. Also be sure to let me know if you need more information.

For a bit more description of the issue, the issue occurs when delayed_jobs tries to add a job to it's DB table. This process currently works on my local development machine, but, it breaks on Heroku.

I am using rails Rails 3.2.9 & delayed_job 3.0.0

Thank you for any help that can be provided on this issue!

PG::Error: ERROR:  invalid input syntax for type timestamp: "--- 1
"
: INSERT INTO "delayed_jobs" ("attempts", "created_at", "failed_at", "handler", "last_error", "locked_at", "locked_by", "priority", "queue", "run_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) RETURNING "id"
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:1166:in `get_last_result'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:1166:in `exec_cache'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `block in exec_query'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:661:in `exec_query'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/database_statements.rb:63:in `exec_insert'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/database_statements.rb:90:in `insert'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/relation.rb:66:in `insert'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/persistence.rb:367:in `create'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/timestamp.rb:58:in `create'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/callbacks.rb:268:in `block in create'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:403:in `_run__747028778094170561__create__3813269534038481014__callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:405:in `__run_callback'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:385:in `_run_create_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:81:in `run_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/callbacks.rb:268:in `create'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/persistence.rb:348:in `create_or_update'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/callbacks.rb:264:in `block in create_or_update'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:414:in `_run__747028778094170561__save__3813269534038481014__callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:405:in `__run_callback'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:81:in `run_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/callbacks.rb:264:in `create_or_update'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/persistence.rb:84:in `save'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/validations.rb:50:in `save'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/attribute_methods/dirty.rb:22:in `save'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/transactions.rb:208:in `transaction'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/transactions.rb:259:in `block in save'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/transactions.rb:258:in `save'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.4/lib/delayed/backend/base.rb:32:in `block (2 levels) in enqueue'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.4/lib/delayed/lifecycle.rb:60:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.4/lib/delayed/lifecycle.rb:60:in `block in initialize'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.4/lib/delayed/lifecycle.rb:65:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.4/lib/delayed/lifecycle.rb:65:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.4/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.4/lib/delayed/backend/base.rb:30:in `block in enqueue'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.4/lib/delayed/backend/base.rb:29:in `tap'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.4/lib/delayed/backend/base.rb:29:in `enqueue'
/app/lib/tasks/builder.rake:4:in `block (2 levels) in <top (required)>
Shawn Deprey

Has nobody encountered this issue before?

David Genord II
Owner

What does you enqueue call look like?

Shawn Deprey

Hi @albus522
Thanks for getting back. Here is how I am calling my enqueue.

Delayed::Job.enqueue(BuildRyse.new, 0, 1.second)
David Genord II
Owner

Well first, you have been ignoring
[DEPRECATION] Passing multiple arguments to #enqueue is deprecated. Pass a hash with :priority and :run_at.

Second it needs to be 1.second.ago or 1.second.from_now which gives you a time object.

So that should look like.

Delayed::Job.enqueue(BuildRyse.new, :priority => 0, :run_at => 1.second.from_now)
David Genord II albus522 closed this
Shawn Deprey

@albus522

Thanks very much albus! I am still having a boxing match with heroku(piece-of-junk), but, delayed_jobs is kicking ass!

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.