Reentrant Scrips

Is there anything taboo about, say, creating a Comment on a ticket from
within a ScripAction?

The main problem that I can see is that you open the possibility of
recursing the RT server to death, unless you disable scrips, or catch the
recursion the next time. And in this instance, I’m wanting to keep the
scrips enabled :wink:

                         Bruce Campbell                            RIPE
                                                                    NCC
                                                             Operations

Nothing innately taboo. but I can’t think of a good way to catch infinite
recursion there. It sounds like a new and better way to shoot oneself in
the foot :wink: I’d probably check to make sure that the transaction type you’re
about to create isn’t the same as the transaction type that was just created.

ponderOn Fri, Jan 11, 2002 at 11:12:56PM +0100, Bruce Campbell wrote:

Is there anything taboo about, say, creating a Comment on a ticket from
within a ScripAction?

The main problem that I can see is that you open the possibility of
recursing the RT server to death, unless you disable scrips, or catch the
recursion the next time. And in this instance, I’m wanting to keep the
scrips enabled :wink:


Bruce Campbell RIPE
NCC
Operations


rt-devel mailing list
rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel

http://www.bestpractical.com/products/rt – Trouble Ticketing. Free.

Nothing innately taboo. but I can’t think of a good way to catch infinite
recursion there. It sounds like a new and better way to shoot oneself in
the foot :wink: I’d probably check to make sure that the transaction type you’re
about to create isn’t the same as the transaction type that was just created.

Well, the simplest way is to put the onus on the RT Admin, but I really
doubt that every RT Admin is going to read any GREAT BIG WARNING messages
in the code :wink:

My thoughts on avoiding recursion is simplified by the fact that I’m
putting a known string into the comment. A match on this string in the
current transaction would therefore indicate a recursion loop, and we
don’t prolong it ;).

I don’t think that there would be any neat way of RT itself detecting when
Scrips are causing recursion, without building (in effect) a ScripStack
and bombing out when the same name appears an arbitary number of times.
A less-neat alternative would be for the Scrip to not run if the time
taken for this RT instance exceeds an arbitary number.

Besides, I can shoot myself in the foot with only 1 line of code, I don’t
need the extra ~22,000 opportunities that RT offers me :wink:

                         Bruce Campbell                            RIPE
                                                                    NCC
                                                             Operations