How to wait for db operation to be completed?

Asked by Torsten Spindler

Our application uses a shared database for storage purposes. Depending on the workload on the db, it can either save data instantly or it may take a second or two. Is there a better way than adding a static wait(2) to the sikuli script to handle this situation? Would it be better or more robust to waitVanish for the busy mouse cursor? How is the situation of dialogs that either disappear instantly or after at most a few second best dealt with?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

--- Would it be better or more robust to waitVanish for the busy mouse cursor?
not possible - no feature. The mouse cursor is not "visible" for Sikuli, since the used Java class Robot does not include the mouse cursor when capturing. So if there are no other visual effects, that tell you it is finished, then there is no possibility with the features of Sikuli.
If it is a standard DB, that can be accessed via JDBC, then there might be other possibilities directly with Python/Java, to check the status of the DB (do not know, wether this makes sense in your case)

--- How is the situation of dialogs that either disappear instantly or after at most a few second best dealt with?
both wait() and waitVanish() wait for the event the given max time to wait, but return in the moment, the event happens (wait -> appears, waitVanish -> disappears)
So giving a generous wait time does no harm at performance, but still gives a FindFailed if the wait time is reached without success (= robust - since it normally does not make sense to continue).

Revision history for this message
Torsten Spindler (tspindler) said :
#2

Thanks RaiMan, that solved my question.