[rt-users] TransactionBatch scrip got fired twice
Daniel Silveira
DSilveira at prmg.mpf.gov.br
Wed Oct 5 13:44:41 EDT 2011
Thank you, Kevin.
Do you suggest any workaround for this?
>>> Kevin Falcone <falcone at bestpractical.com> 10/04/11 2:23 pm >>>
Have a look at
http://issues.bestpractical.com/Ticket/Display.html?id=18426
-kevin
On Tue, Oct 04, 2011 at 01:32:48PM -0300, Daniel Silveira wrote:
> Ok.
> Put the log on both boxes. Preparation and Commit (clean-up):
>
> Condition: on transaction
> Action: User Defined
> Template: Global template: Blank
> Stage: TransactionBatch
> Custom condition:
> empty
> Custom action preparation code:
> $RT::Logger->info("Preparation-box - Id: ".$self->TransactionObj->Id);
> return 1;
> Custom action cleanup code:
> $RT::Logger->info("Commit-box - Id: ".$self->TransactionObj->Id);
> return 1;
>
>
> The log shows:
> [Tue Oct 4 16:27:24 2011] [info]: Preparation-box - Id: 323773 ((eval 1629):1)
> [Tue Oct 4 16:27:24 2011] [info]: Commit-box - Id: 323773 ((eval 1635):1)
> [Tue Oct 4 16:27:24 2011] [info]: Preparation-box - Id: 323773 ((eval 1641):1)
> [Tue Oct 4 16:27:24 2011] [info]: Commit-box - Id: 323773 ((eval 1647):1)
> It doesn't happen with "On Comment" or "On correspond". Only "On transaction".
> Any sugestion?
> What could be wrong?
> Daniel Silveira
> >>> Ruslan Zakirov <ruz at bestpractical.com> 09/30/11 7:16 pm >>>
> Hi,
>
> Add logging into preparation and commit blocks at the same time. It's
> expected that preparation stage can be executed several times and
> commit code never executed. This is the reason why you shouldn't
> change anything in the preparation code.
>
> On Fri, Sep 30, 2011 at 9:09 PM, Daniel Silveira
> <DSilveira at prmg.mpf.gov.br> wrote:
> > I tried both action boxes, the same problem happened.
> > My RT is 4.0.2 fresh install, imported database from RT 3.8.8.
> > To add more info, I changed the log a bit. The configuration now is:
> >
> > Condition: on transaction
> > Action: User Defined
> > Template: Global template: Blank
> > Stage: TransactionBatch
> >
> > Custom condition:
> > empty
> > Custom action preparation code:
> > $RT::Logger->info("Id: ".$self->TransactionObj->Id);
> > $RT::Logger->info("Field: ".$self->TransactionObj->Field);
> > $RT::Logger->info("Type: ".$self->TransactionObj->Type);
> > $RT::Logger->info("NewValue: ".$self->TransactionObj->NewValue );
> > return 1;
> > Custom action cleanup code:
> > return 1;
> >
> > The log after changing the Time Worked to 30min:
> >
> > [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1836):1)
> > [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1836):2)
> > [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1836):3)
> > [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1836):4)
> > [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1854):1)
> > [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1854):2)
> > [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1854):3)
> > [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1854):4)
> > I noticed that the problem doesn't happen when the scrip is acting upon "on
> > comment" condition.
> > But with other conditions like "On Status Change" and "On Owner Change" the
> > problem persists.
> > If I change the action to "Send Email", which is what i want, the system
> > sends 2 emails.
> >
> > Thanks in advance.
> > Daniel Silveira
> >>>> Kevin Falcone <falcone at bestpractical.com> 09/29/11 6:56 pm >>>
> > On Thu, Sep 29, 2011 at 06:39:03PM -0300, Daniel Silveira wrote:
> >> Hi,
> >>
> >> I have the exact same problem with a very simple test-only scrip:
> >>
> >> Condition: on a transaction
> >> Action: user defined
> >> Stage: TransactionBatch
> >>
> >> Action code:
> >> $RT::Logger->info($self->TransactionObj->Id);
> >
> > There are two action boxes.
> >
> > Custom action preparation code:
> > Custom action cleanup code:
> >
> > Which one did you put the log in.
> > What did you put in the other one.
> >
> > -kevin
> >
> >> Every transaction generated fires twice this scrip. If I chage the
> >> stage to TransactionCreate,
> >> then it works.
> >>
> >> Logfile:
> >> [Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1558):1)
> >> [Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1566):1)
> >> [Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1582):1)
> >> [Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1590):1)
> >> Thank you.
> >> Daniel Silveira
> >>
> >> On Thu, Sep 29, 2011 at 11:10:20AM -0400, Xin, Qiao wrote:
> >> > Hi,
> >> >
> >> > I have a scrip to to check when the ticket status changes. If I put it
> >> as TransactionBatch mode,
> >> > each time I change the ticket status, the scrip got fired twice and
> >> there will be dupllicated emails
> >> > sent out. I had to use TransactionBatch, since we want an email
> >> notification to be sent out when
> >> > either
> >> > 1. the user use reply and modify the ticket status
> >> > 2. modify the ticket status
> >> >
> >> > TransactionBatch works fine when user reply and modify ticket status
> >> but got duplicated emails when
> >> > just change ticket status.
> >>
> >> Please show your scrip configuration
> >>
> >> -kevin
> >
> >> --------
> >> RT Training Sessions (http://bestpractical.com/services/training.html)
> >> * San Francisco, CA, USA ? October 18 & 19, 2011
> >> * Washington DC, USA ? October 31 & November 1, 2011
> >> * Melbourne VIC, Australia ? November 28 & 29, 2011
> >> * Barcelona, Spain ? November 28 & 29, 2011
> >
> >
> > --------
> > RT Training Sessions (http://bestpractical.com/services/training.html)
> > * San Francisco, CA, USA -- October 18 & 19, 2011
> > * Washington DC, USA -- October 31 & November 1, 2011
> > * Melbourne VIC, Australia -- November 28 & 29, 2011
> > * Barcelona, Spain -- November 28 & 29, 2011
> >
>
> --
> Best regards, Ruslan.
> --------
> RT Training Sessions (http://bestpractical.com/services/training.html)
> * San Francisco, CA, USA ? October 18 & 19, 2011
> * Washington DC, USA ? October 31 & November 1, 2011
> * Melbourne VIC, Australia ? November 28 & 29, 2011
> * Barcelona, Spain ? November 28 & 29, 2011
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20111005/f67a2a6e/attachment.htm>
More information about the rt-users
mailing list