I'm not really that knowledgeable about thread-safe vs non-thread-safe operations but am wondering if a problem I'm seeing might be because of that.
In my modules directory I've created a module that has a class defined.
Then in db.py I have an _after_insert trigger like so:
db.workorder._after_insert.append(lambda s,f: workorderAfterInsert(s,f))
In my _after_insert trigger I'm instantiating the class from my module like this:
import workorder.sequencer as sequencer
workorderId = id
wo = db.workorder(workorderId)
sequencer = sequencer.Sequencer(workorder_id=workorderId, db=db)
sequencer.build_bom()
sequencer.sequence()
sequencer.save_sequenced_workorder()
db.commit()
I'm not sure how to describe it, but I'm seeing random errors popping up in the execution of sequencer.sequence(). My only thought at this point is that there are thread-safe or concurrency issues going on.
I'd really appreciate it if someone could tell me whether or not this is safe (or wise). Any input would be appreciated.
-Jim