Scrip "too fast" or dirty read from db or what?

Hi List,

I have the following problem on an RT 3.8.8:
There is a simple scrip that notifies the owner on comments. Sometimes this
scrip sends
"This transaction appears to have no content" instead of the real textural
content of the incoming e-mail.
This problem mainly present if there are file attachements of the email.

But if I run the following code from CLI the outgoing mail contains the
good content not the “This trans…” warning message:
my $tic = RT::Ticket->new($RT::SystemUser);

my $tr = RT::Transaction->new($RT::SystemUser);

my $scrip = RT::Scrip->new($RT::SystemUser);

$scrip->Prepare(TicketObj => $tic, TransactionObj => $tr);
$scrip->Commit(TicketObj => $tic, TransactionObj => $tr);

So it seems to me that scrip runs earlier than the attachements of
transaction inserted into the DB
or there is some kind of MySQL cache problem which causes dirty read
but there aren’t any special MySQL settings.

What do you think?