There are a number of messages in the queued_messages table which have the locked_by field filled in with a reference presumably to a no-longer-existing process. The messages date back some months which means the original message has been removed from the server.
This means that there are several queue pages in the UI which throw exceptions because they're trying to load messages which don't exist.
Is the issue that queued_messages are never cleaned up by the automatic process or that the automatic clean up process removes messages despite them being present in the queue?
@willpower232 we can try that by using smtp relays......but there is problem with authentication in relays
Is there any solution for that????
(Manish's comment is unrelated and resolved by https://github.com/atech/postal/issues/48#issuecomment-373334092)
In case anyone else needs the fix, the workaround looks like this
Add the following at the end of the queue method here https://github.com/atech/postal/blob/master
countbroken = 0
for message in @messages
begin
test = message.message
rescue
message.destroy
countbroken += 1
end
end
if countbroken > 0
@messages = @server.queued_messages.order(:id => :desc).page(params[:page])
end
can this help with #717 ? and can I run this via rails console bin/rails c?
If you have deleted the messages from the main table and are now unable to open the queued messages page, then this will help you.
The process of catching the exception to delete a disassociated message might be able to be run from the console but I am not sure how.
In case anyone else needs the fix, the workaround looks like this
Add the following at the end of the
queuemethod here https://github.com/atech/postal/blob/mastercountbroken = 0 for message in @messages begin test = message.message rescue message.destroy countbroken += 1 end end if countbroken > 0 @messages = @server.queued_messages.order(:id => :desc).page(params[:page]) end
Hello @willpower232
I trust you are doing great.
What is the file location to apply this solution?
Thanks
Terribly sorry, not sure what happened to the link.
I added that code between these two lines https://github.com/atech/postal/blob/master/app/controllers/servers_controller.rb#L70-L71
Alright.
Thank you!