Add Asynchronous Connection Pooling Support to PostgresChatMessageHistory #130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for asynchronous connection pooling in the
PostgresChatMessageHistoryclass, addressing issues #122 and #129Changes Made:
PostgresChatMessageHistory:conn_poolparameter to accept anAsyncConnectionPoolinstance.__init__method to includeconn_pooland reordered parameters for improved usability.session_idandtable_namecan be passed as keyword arguments.aget_messagesandaadd_messagesto utilize the connection pool when provided.async_connectionto ensure backward compatibility.test_async_chat_history_with_poolintests/unit_tests/test_chat_histories.pyto verify the new functionality.PostgresChatMessageHistorywith an asynchronous connection pool.conn_poolparameter.Example Usage:
Testing:
Added a new test
test_async_chat_history_with_poolintests/unit_tests/test_chat_histories.py:Ensured all existing tests pass, maintaining backward compatibility.
Documentation:
__init__method.Notes:
sync_connectionorasync_connectioncontinues to work without modifications.Related Issues:
PostgresChatMessageHistorywith async connections when usingRunnableWithMessageHistory? #122