File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 1- import atexit
21import os
32from functools import lru_cache
43from typing import List , Optional
1413_agent_executor = None
1514
1615
17- @lru_cache
16+ @lru_cache ( maxsize = 1 )
1817def get_checkpointer ():
1918 DATABASE_URL = os .environ .get ("DATABASE_URL" )
2019 if not DATABASE_URL :
2120 raise RuntimeError ("DATABASE_URL is not set. Point it to your Neon connection string." )
2221
23- cm = PostgresSaver .from_conn_string (DATABASE_URL )
24- saver = cm .__enter__ () # enter the context manager once
25- atexit .register (lambda : cm .__exit__ (None , None , None )) # clean shutdown
26- saver .setup () # create tables on first run; no-op afterward
27- return saver
22+ checkpointer = PostgresSaver .from_conn_string (DATABASE_URL )
23+ checkpointer .setup () # create tables on first run; no-op afterward
24+ return checkpointer
2825
2926
3027def get_agent ():
You can’t perform that action at this time.
0 commit comments