Recent fixes -> release/v2.4 (#891)

* Fix publisher resource leak in librarian submit_document (#883)

Wrap pub.start()/pub.send() in try/finally to guarantee pub.stop() is
called on error. Remove unnecessary asyncio.sleep(1) kludge.

* Make Cassandra replication factor configurable (issue #787) (#887)

Add CASSANDRA_REPLICATION_FACTOR environment variable and
--cassandra-replication-factor CLI argument to cassandra_config.py.

Update all four table store constructors (ConfigTableStore,
KnowledgeTableStore, LibraryTableStore, IamTableStore) to accept
an optional replication_factor parameter and use it in keyspace
creation CQL queries.

Thread the replication factor through all service constructors:
Configuration, KnowledgeManager, Librarian, IamService, and
knowledge store Processor.

* Update tests

---------

Co-authored-by: gittihub-jpg <rico@springer-mail.net>
This commit is contained in:
cybermaggedon 2026-05-08 19:48:12 +01:00 committed by GitHub
parent fe542b3d33
commit fd8d5b2c42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 105 additions and 72 deletions

View file

@ -218,7 +218,8 @@ class TestKgStoreConfiguration:
cassandra_host=['kg-env-host1', 'kg-env-host2', 'kg-env-host3'],
cassandra_username='kg-env-user',
cassandra_password='kg-env-pass',
keyspace='knowledge'
keyspace='knowledge',
replication_factor=1,
)
@patch('trustgraph.storage.knowledge.store.KnowledgeTableStore')
@ -239,7 +240,8 @@ class TestKgStoreConfiguration:
cassandra_host=['explicit-host'],
cassandra_username='explicit-user',
cassandra_password='explicit-pass',
keyspace='knowledge'
keyspace='knowledge',
replication_factor=1,
)
@patch('trustgraph.storage.knowledge.store.KnowledgeTableStore')
@ -260,7 +262,8 @@ class TestKgStoreConfiguration:
cassandra_host=['compat-host'],
cassandra_username=None, # Should be None since cassandra_user is ignored
cassandra_password='compat-pass',
keyspace='knowledge'
keyspace='knowledge',
replication_factor=1,
)
@patch('trustgraph.storage.knowledge.store.KnowledgeTableStore')
@ -277,7 +280,8 @@ class TestKgStoreConfiguration:
cassandra_host=['cassandra'],
cassandra_username=None,
cassandra_password=None,
keyspace='knowledge'
keyspace='knowledge',
replication_factor=1,
)
@ -425,5 +429,6 @@ class TestConfigurationPriorityIntegration:
cassandra_host=['param-host'], # From parameter
cassandra_username='env-user', # From environment
cassandra_password='env-pass', # From environment
keyspace='knowledge'
keyspace='knowledge',
replication_factor=1,
)