Postal: Messages in queue not cleaned

Created on 9 Mar 2018  路  8Comments  路  Source: postalhq/postal

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?

bug

All 8 comments

@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 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

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

harshweo picture harshweo  路  6Comments

destroyer998 picture destroyer998  路  5Comments

ILoveYaToo picture ILoveYaToo  路  3Comments

Igcorreia picture Igcorreia  路  4Comments

fschndr picture fschndr  路  6Comments