Skip to content

Commit 79afc40

Browse files
committed
update README
1 parent 2e2b525 commit 79afc40

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ from tornado import gen
2525
import tormysql
2626
2727
pool = tormysql.ConnectionPool(
28-
max_connections = 20,
28+
max_connections = 20, #max open connections
29+
idle_seconds = 7200, #conntion idle timeout time, 0 is not timeout
2930
host = "127.0.0.1",
3031
user = "root",
3132
passwd = "TEST",
@@ -34,7 +35,7 @@ pool = tormysql.ConnectionPool(
3435
)
3536
3637
@gen.coroutine
37-
def connect():
38+
def test():
3839
conn = yield pool.Connection()
3940
cursor = conn.cursor()
4041
yield cursor.execute("SELECT * FROM test")
@@ -43,11 +44,10 @@ def connect():
4344
conn.close()
4445
4546
print datas
46-
47-
def start():
48-
connect()
47+
48+
yield pool.close()
4949
5050
ioloop = IOLoop.instance()
51-
ioloop.add_callback(start)
51+
ioloop.add_callback(test)
5252
ioloop.start()
5353
```

test/test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import tormysql
1313

1414
pool = tormysql.ConnectionPool(
15+
max_connections = 20,
16+
idle_seconds = 7200,
1517
host = "127.0.0.1",
1618
user = "root",
1719
passwd = "123456",

0 commit comments

Comments
 (0)