You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.
I am using Sidekiq for the background process and creat a very simple application to validate Sidekiq functionality. I am getting success response but getting failure message when calling it through sidekiq. Please help me resolve this issue.
Error Message :
2018-01-21T15:40:57.662Z 73625 TID-outayy7ac WARN: {"context":"Job raised exception","job":{"class":"ProcessWorker","args":["{"name"=>"Hello", "description"=>"Hello666", "author"=>"Hello"}"],"retry":true,"queue":"default","jid":"866561849a5cd5336ef03cc4","created_at":1516548964.76175,"enqueued_at":1516549257.6588979,"error_message":"When assigning attributes, you must pass a hash as an argument.","error_class":"ArgumentError","failed_at":1516548964.76448,"retry_count":3,"retried_at":1516549132.7047172},"jobstr":"{"class":"ProcessWorker","args":["{\"name\"=>\"Sumit8901\", \"description\"=>\"Hello666\", \"author\"=>\"Hello7777\"}"],"retry":true,"queue":"default","jid":"866561849a5cd5336ef03cc4","created_at":1516548964.76175,"enqueued_at":1516549257.6588979,"error_message":"When assigning attributes, you must pass a hash as an argument.","error_class":"ArgumentError","failed_at":1516548964.76448,"retry_count":3,"retried_at":1516549132.7047172}"}
2018-01-21T15:40:57.662Z 73625 TID-outayy7ac WARN: ArgumentError: When assigning attributes, you must pass a hash as an argument.
2018-01-21T15:40:57.662Z 73625 TID-outayy7ac WARN:
Please find the below code-
Controller class:
books_controller.rb
def create @job=ProcessWorker.perform_async(book_params)
h = {"response" => {"job_id" => @job}}
render json: h
end
Worker Class:
class ProcessWorker
include Sidekiq::Worker
def perform(book_params)
book = Book.new(book_params)
book.save
end
end
Migrations Class:
class CreateBooks < ActiveRecord::Migration[5.1]
def change
create_table :books do |t|
t.string :name
t.string :description
t.string :author
t.timestamps
end
end
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am using Sidekiq for the background process and creat a very simple application to validate Sidekiq functionality. I am getting success response but getting failure message when calling it through sidekiq. Please help me resolve this issue.
Error Message :
2018-01-21T15:40:57.662Z 73625 TID-outayy7ac WARN: {"context":"Job raised exception","job":{"class":"ProcessWorker","args":["{"name"=>"Hello", "description"=>"Hello666", "author"=>"Hello"}"],"retry":true,"queue":"default","jid":"866561849a5cd5336ef03cc4","created_at":1516548964.76175,"enqueued_at":1516549257.6588979,"error_message":"When assigning attributes, you must pass a hash as an argument.","error_class":"ArgumentError","failed_at":1516548964.76448,"retry_count":3,"retried_at":1516549132.7047172},"jobstr":"{"class":"ProcessWorker","args":["{\"name\"=>\"Sumit8901\", \"description\"=>\"Hello666\", \"author\"=>\"Hello7777\"}"],"retry":true,"queue":"default","jid":"866561849a5cd5336ef03cc4","created_at":1516548964.76175,"enqueued_at":1516549257.6588979,"error_message":"When assigning attributes, you must pass a hash as an argument.","error_class":"ArgumentError","failed_at":1516548964.76448,"retry_count":3,"retried_at":1516549132.7047172}"}
2018-01-21T15:40:57.662Z 73625 TID-outayy7ac WARN: ArgumentError: When assigning attributes, you must pass a hash as an argument.
2018-01-21T15:40:57.662Z 73625 TID-outayy7ac WARN:
Please find the below code-
Controller class:
books_controller.rb
def create
@job=ProcessWorker.perform_async(book_params)
h = {"response" => {"job_id" => @job}}
render json: h
end
Worker Class:
class ProcessWorker
include Sidekiq::Worker
def perform(book_params)
book = Book.new(book_params)
book.save
end
end
Migrations Class:
class CreateBooks < ActiveRecord::Migration[5.1]
def change
create_table :books do |t|
t.string :name
t.string :description
t.string :author
end
The text was updated successfully, but these errors were encountered: