Closed luizkowalski closed 8 years ago
Can you provide a small rails app/example that shows the issue? It is really hard to say based on the tiny bit of code you have provided.
well, there is not much than that, actually. I installed qu and qu-mongoid, moved the method responsible to send the message to a Job and enqueued on after_save...that's it, but I can try provide more code, I'll try to share the code later
I still having this issue. Here is the whole process:
message_controller
def create
message = Message.new(message_params)
message.room = room
message.user = current_user
message.save
MetricServices.message_sent(current_user.uid, room: message.room.name)
render nothing: true
end
message_observer
def after_save(message)
SendMessageJob.create message.id
end
send_message_job
class SendMessageJob < Qu::Job
def initialize(message_id)
@message_id = message_id
end
def perform
message = Message.find @message_id
room = "room_#{message.room.uid}"
WebsocketRails[room].trigger :new_message, message.present.to_html
end
end
I'm starting the app with rails server
and JUST THIS...the message is still processed.
Also, I didn't saw anything on my mongo database. is this right? should I see something, like a queue collection or whatever?
anything?
A couple things. I'm not 100% positive that master is stable right now. We've been tweaking things for a while to make some big breaking API changes for the long term good. It should be stable, but if it is, the API will change soon, so I wouldn't pin to master. I'd pin to the latest release and upgrade later.
Second, where are you configuring qu? It seems like the qu-immediate backend is being used or something.
I'll try to change to the latest stable and actually, I haven't any config file for qu...only the bundle exec rake qu:work
on the Procfile
but it is commented, so it is not executing
I have an app with Rails 4.2.2 (using mongoid) running qu from master branch, and I'm seeing this strange behavior. On my
model_obserer
I have this codeI started my server, but didn't ran the command
bundle exec rake qu:work
but the messages were still delivered to the rooms... This is unexpected, is there something wrong?