[Bug 14791] New: Automatically attempt to resend failed notices
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Bug ID: 14791 Summary: Automatically attempt to resend failed notices Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Notices Assignee: koha-bugs@lists.koha-community.org Reporter: larit@student.uef.fi QA Contact: testopia@bugs.koha-community.org Sometimes notices keep failing due to problems in network and they should be resent. Last week in my local library we experienced some network trouble and plenty of messages went into failed status. This can also be somewhat risky by manual SQL queries in production environment. Bug 12426 introduces a subroutine C4::Letters::ResendMessage($message_id) for resending failed messages. Problem is that if we run this kind of feature as cronjob, we can end up in an infinite loop of sending the same messages over and over again and they will never be sent because of missing/invalid to_address or smsalertnumber. However, Bug 14590 focuses on setting valid messaging preferences for all users. With the feature presented in Bug 14590 we can assume that all notifications will have proper messaging preferences. If we do not want to rely on Bug 14590: Another option would be to track messages that we already attempted to resend. We could try to resend each failed message for lets say 5 times each time increasing the time between last attempt. Once the message has been attempted to send 5 times, we will stop our attempts to resend it. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 --- Comment #1 from Lari Taskula <larit@student.uef.fi> --- (In reply to Lari Taskula from comment #0)
Last week in my local library we experienced some network trouble and plenty of messages went into failed status. This can also be somewhat risky by manual SQL queries in production environment.
Long day. What I meant to say was that currently the only way to resend failed messages without Bug 12426 is via manual database UPDATE queries to set them back into "pending" status, and this leaves some chance for it to go horribly wrong. Anyway, I also though of a third option. We could use Koha::Exceptions introduced in Bug 13995 to throw an exception to C4::Letters in case of a connection failure. C4::Letters would catch this exception and leave the message in the queue untouched. In other words, the message would stay in pending status and would be attempted to send again by process_message_queue.pl. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |13995 Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13995 [Bug 13995] Proper Exception handling -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 --- Comment #2 from Lari Taskula <larit@student.uef.fi> --- Created attachment 42463 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=42463&action=edit Bug 14791: Resend failed notices - Add Koha::Exceptions to SMS::Send drivers Sometimes notices keep failing due to various reasons. One common problem is network connection failures. Because of this, the notices go into 'failed' status without another attempt for sending. This is very problematic, because we have to not only monitor the failed messages but also resend them manually. The purpose of this patch is to move us into more automated way of handling delivery failures. This patch enables us to handle exceptions in SMS messaging. The main idea is to throw an exception from SMS::Send driver in case of a failure. The exception will be caught by C4::SMS and from here it will be forwarded to C4::Letters where instead of automatically setting the message into 'failed' status, we now can do as we wish with various exceptions. As an example I have caught Koha::Exception::ConnectionFailed in C4::Letters::_send_message_by_sms(). When we catch the said exception, we simply leave the message in 'pending' status. This way it will be resent whenever process_message_queue.pl is executed again. There are multiple other reasons of failure where Exceptions will come in handy. For example the SMS Gateway provider may return some errors at request, and with this patch we will be able to handle them better. Below is a short example for making your SMS::Send driver throw an exception in case of a connection failure in SMS/Send/MyDriver/Driver.pm. _______________________________________________________________ use Koha::Exception::ConnectionFailed; sub send_sms { #.....your implementation..... # Throw an exception in case of a connection error # $connError can be for example: ($curl->{'retcode'} == 6) # cURL code 6: CURLE_COULDNT_RESOLVE_HOST if ($connError){ Koha::Exception::ConnectionFailed->throw(error => "Connection failed"); } #.....your implementation..... } _______________________________________________________________ prerequisites: -2. Set system preference SMSSendDriver to Example::ExceptionExample -1. Enable system preference EnhancedMessagingPreferences To test: 1. Have/create some pending sms messages into message_queue 2. Go to Patrons -> Notices 3. Observe that the your message is in pending status 4. Apply patch 5. Run misc/cronjob/process_message_queue.pl 6. Observe that your message is still in pending status You can also test it with your own implementation of SMSSendDriver. What you need to do is follow the example mentioned earlier to make send_sms() subroutine throw Koha::Exception::ConnectionFailed in case of a connection failure. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |larit@student.uef.fi |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #42463|0 |1 is obsolete| | --- Comment #3 from Lari Taskula <larit@student.uef.fi> --- Created attachment 42465 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=42465&action=edit Bug 14791: Resend failed notices - Add Koha::Exceptions to SMS::Send drivers -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=14723, | |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=14767 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |14767 Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14767 [Bug 14767] Message delivery notes from SMS Gateway provider reports -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on|13995 |14723 Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13995 [Bug 13995] Proper Exception handling http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14723 [Bug 14723] Additional delivery notes to messages -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #42465|0 |1 is obsolete| | --- Comment #4 from Lari Taskula <larit@student.uef.fi> --- Created attachment 42467 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=42467&action=edit Bug 14791: Resend failed notices - Add Koha::Exceptions to SMS::Send drivers -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |13995 Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13995 [Bug 13995] Proper Exception handling -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #42467|0 |1 is obsolete| | --- Comment #5 from Lari Taskula <larit@student.uef.fi> --- Created attachment 42468 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=42468&action=edit Bug 14791: Resend failed notices - Add Koha::Exceptions to SMS::Send drivers Added 1 more test. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=14843 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #42468|0 |1 is obsolete| | --- Comment #6 from Lari Taskula <larit@student.uef.fi> --- Created attachment 42697 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=42697&action=edit Bug 14791: Resend failed notices - Add Koha::Exceptions to SMS::Send drivers Adding failsafes to _send_message_by_sms catch-block. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #42697|0 |1 is obsolete| | --- Comment #7 from Lari Taskula <larit@student.uef.fi> --- Created attachment 42698 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=42698&action=edit Bug 14791: Resend failed notices - Add Koha::Exceptions to SMS::Send drivers -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Mike <black23@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |black23@gmail.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14791 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=12426 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org