Is it possible to get FR to recognize scheduled ta...
# fusion-reactor
j
Is it possible to get FR to recognize scheduled tasks as transactions? Web requests are helpful because they bottle up all of the underlying threads so it's easy to profile and visualize the slow parts, but with scheduled tasks I only see the individual threads/database calls intermixed with other transactions.
b
I'm not sure I follow. Lucee and Adobe scheduled tasks just hit a URL for you, so they should show up a a normal URL being hit I would think.
Is that not the case?
j
CbScheduler. Cbq specifically
b
That's a totally different question 🙂
j
Good thing you’re here to clarify
b
This library has methods that allow you to start end end your own top level transactions
Copy code
var tran = FRTransService.startTransaction( 'name', 'description' );
try {
  // Do stuff here
} catch( any e ) {
  FRTransService.errorTransaction( tran, e );
  rethrow;
} finally {
  // you MUST call this or the transaction will never show as being finished in FR's interface
  FRTransService.endTransaction( tran )
}
You can basically make anything you want a transaction, including nested them if you like
The library will become a no-op if FR isn't intalled on the server
d
Sweet! Didn't know about this!
j
@elpete
Thanks Brad!
e
Just to clarify, @bdw429s, if I add this to cbq or we add this to ColdBox, it won’t interfere if someone doesn’t have FR installed.
b
Correct
👍🏻 1
It tries loading the FR class when the CFC is initted, and then cached the "status" if FR isn't available so all the methods short circuit.