Algorithm for max searches per minute

User 104a68add6

06-06-2005 19:23:24

Hi,


I am writing some pl/sql to do structure searches with the jchem cartridge, and I need to take into account my maximum allowed searches per minute.





Our license is for 8/minute. If I run 8 searches in less than a minute, I will just have my code sleep til the next minute starts, and then start looping on more searches. But it will be more complicated than that, I am sure....it depends on how your software counts....whether it pays attention to total time elapsed, or ....?





If I run 7 searches in a little over a minute, will I be able to do 9 more before the 2nd minute finishes, which is an average of 8/min? Or is the search counter reset after 1 minute is elapsed, no matter how few searches were done in that minute....so when that next minute starts, I can only do 8 searches in the subsequent 60 seconds?





I want to avoid getting the exception for too many searches, so this can run unattended on dozens of searches....so I need to count my searches and time elapsed the same way the cartridge does. I am sorry if this seems so poorly worded.





Many thanks,


Julie Myhre

ChemAxon 9c0afc9aaf

07-06-2005 11:42:54

Hi Julie,





The number of searches must not exceed the limit in any given minute.


(so no average is calculated)





To more specific, JChem stores the start time of past searches, and if more searches were started than the limit in the past 60 seconds, it will throw an exception.





Unsuccessful tries (when this exception occurs) are not registered of course, so these do not increase the number of performed searches.





Best regards,





Szilard