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

AlgoliaJob for the deleted record always rise ActiveJob::DeserializationError #359

Open
zhukovpe opened this issue Jul 11, 2019 · 3 comments · May be fixed by #422
Open

AlgoliaJob for the deleted record always rise ActiveJob::DeserializationError #359

zhukovpe opened this issue Jul 11, 2019 · 3 comments · May be fixed by #422

Comments

@zhukovpe
Copy link

  • Rails version: 4.2.11.1
  • Algolia Rails integration version: 1.18.0
  • Algolia Client Version: 1.12.5
  • Language Version: 2.4.6

Description

Asynchronous index update enqueues a job with the specific object instance as a parameter. This specific object cannot be deserialized from the parameter during job processing for the deleted record. An asynchronous index update job for the deleted record will always fail.

A possible solution according to job guidelines could be to enqueue a job with the record identifier as a parameter, not the instance itself. Decouple index update logic from the model and use this logic inside job. We need only an ID to delete a record from the index, not the object itself.

Steps To Reproduce

  1. Create a simple model with the Algolia included and configured to update the index asynchronously
class School
  include Mongoid::Document
  include AlgoliaSearch

  field :title,                type: String
  field :description,          type: String
  field :street,               type: String
  field :zipcode,              type: String
  field :city,                 type: String

  algoliasearch per_environment: true, enqueue: true do
    attributes :title, :street, :zipcode, :city
  end
end
  1. Create an object, destroy an object.
s = School.create(
  title: 'Fancy',
  street: 'Claude Bernard',
  zipcode: '75005',
  city: 'Paris'
)
s.destroy
  1. Ensure the job fails within your asynchronous worker
ActiveJob::DeserializationError: Error while trying to deserialize arguments:...
@balakirevs
Copy link

have you resolved it?

@zhukovpe
Copy link
Author

zhukovpe commented Oct 17, 2019

have you resolved it?

made a PR
#369

@marckohlbrugge
Copy link

Does anyone have a (temporary) workaround for this issue?

I'm now frequently exceeding my quota, because old records don't get deleted.

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