Suppose that I have the following code:
class User < ActiveRecord::Base
update_index('users#user') { self }
after_commit :send_socket_event, on: %i[create update]
def send_socket_event(self):
SockeClient.send(self)
end
end
The socket event is sent to the client then the client creates an http request to get the new user information from an endpoint that makes a query to elastic search. My problem is that the response is done before that the index on ES is updated so the information in the endpoint response isn't already updated.
I wonder if there is something like a callback after index
for the Chewy::Index
class.