diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2017-12-01 21:37:49 -0800 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2017-12-01 21:42:14 -0800 |
commit | e335d6d2234a7bb1d83741f851dba5dbbabd6e3c (patch) | |
tree | be5545f9f2c20bc41b500d4aac462fd40c0ea8d8 /examples/threads.py | |
parent | a51160317c680662c52e4a1a6b4d11beae37f205 (diff) | |
download | psycopg2-e335d6d2234a7bb1d83741f851dba5dbbabd6e3c.tar.gz |
Trim trailing whitespace from all files throughout project
Many editors automatically trim whitespace on save. By trimming all
files in one go, makes future diffs cleaner without extraneous
whitespace changes.
Diffstat (limited to 'examples/threads.py')
-rw-r--r-- | examples/threads.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/threads.py b/examples/threads.py index d24b0a5..e0be7e0 100644 --- a/examples/threads.py +++ b/examples/threads.py @@ -44,7 +44,7 @@ if len(sys.argv) > 1: DSN = sys.argv[1] if len(sys.argv) > 2: MODE = int(sys.argv[2]) - + print "Opening connection using dsn:", DSN conn = psycopg2.connect(DSN) curs = conn.cursor() @@ -70,7 +70,7 @@ def insert_func(conn_or_pool, rows): conn = conn_or_pool else: conn = conn_or_pool.getconn() - + for i in range(rows): if divmod(i, COMMIT_STEP)[1] == 0: conn.commit() @@ -91,14 +91,14 @@ def insert_func(conn_or_pool, rows): ## a nice select function that prints the current number of rows in the ## database (and transfer them, putting some pressure on the network) - + def select_func(conn_or_pool, z): name = threading.currentThread().getName() if MODE == 0: conn = conn_or_pool conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) - + for i in range(SELECT_SIZE): if divmod(i, SELECT_STEP)[1] == 0: try: @@ -125,7 +125,7 @@ else: m = len(INSERT_THREADS) + len(SELECT_THREADS) n = m/2 conn_insert = conn_select = ThreadedConnectionPool(n, m, DSN) - + ## create the threads threads = [] |