Created
August 10, 2015 20:30
-
-
Save movermeyer/220f87b34eba730bb67b to your computer and use it in GitHub Desktop.
Fix to issue #60 causes infinite loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiprocessing | |
import time | |
import firebirdsql | |
FIREBIRD_HOST = "localhost" | |
FIREBIRD_DB = "D:\\LOCALCONFIG.fdb" | |
FIREBIRD_USER = "SYSDBA" | |
FIREBIRD_PASS = "masterkey" | |
def test(number_to_select): | |
conn = firebirdsql.connect(host=FIREBIRD_HOST, database=FIREBIRD_DB, user=FIREBIRD_USER, password=FIREBIRD_PASS) | |
cur = conn.cursor() | |
cur.execute("select FIRST {0} * FROM TEST".format(number_to_select)) | |
results = cur.fetchall() | |
conn.close() | |
if __name__ == '__main__': | |
for i in range(399,402): | |
print "Testing fetching {0} results".format(i) | |
p = multiprocessing.Process(target=test, args=(i,)) | |
p.start() | |
# Wait for 10 seconds or until process finishes | |
p.join(10) | |
# If thread is still active | |
if p.is_alive(): | |
print "Timed out. Killing it!" | |
# Terminate | |
p.terminate() | |
p.join() | |
else: | |
print "Success!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment