Skip to content

Commit b16ee7c

Browse files
authored
docs: update how to set up background thread to ping PingingPool and TransactionPingingPool (#62)
Co-authored-by: larkee <[email protected]>
1 parent df199f7 commit b16ee7c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

docs/advanced-session-pool-topics.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ from becoming stale:
5757
5858
import threading
5959
60-
background = threading.Thread(target=pool.ping, name='ping-pool')
60+
61+
def background_loop():
62+
while True:
63+
# (Optional) Perform other background tasks here
64+
pool.ping()
65+
66+
67+
background = threading.Thread(target=background_loop, name='ping-pool')
6168
background.daemon = True
6269
background.start()
6370
@@ -91,6 +98,13 @@ started before it is used:
9198
9299
import threading
93100
94-
background = threading.Thread(target=pool.ping, name='ping-pool')
101+
102+
def background_loop():
103+
while True:
104+
# (Optional) Perform other background tasks here
105+
pool.ping()
106+
107+
108+
background = threading.Thread(target=background_loop, name='ping-pool')
95109
background.daemon = True
96110
background.start()

0 commit comments

Comments
 (0)