Skip to content

Commit 399af84

Browse files
committed
add retryWrites
1 parent 1484e37 commit 399af84

File tree

7 files changed

+20
-2
lines changed

7 files changed

+20
-2
lines changed

RELEASE_NOTES.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
KBase Feeds Service
22

3+
### Version 1.0.3
4+
* The MongoDB clients have been updated to the most recent version.
5+
* Added the mongo-retrywrites configuration setting in deployment.cfg.templ, defaulting to false.
6+
* Migrated from Travis CI to GitHub Actions (GHA) for CI/CD workflows.
7+
* Updated Python version to 3.7.13.
8+
39
### Version 1.0.2
410
- Add a cache for bad tokens so they aren't looked up over and over. Maxes out at 10000, then throws out the oldest bad token.
511

deployment/conf/.templates/deploy.cfg.templ

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ db-host = {{ default .Env.db_host "ci-mongo" }}
1111
db-port = {{ default .Env.db_port "27017" }}
1212
db-user = {{ default .Env.db_user "feedsserv" }}
1313
db-pw = {{ default .Env.db_pw "fake_password" }}
14+
db-retrywrites={{ default .Env.db_retrywrites "false" }}
1415

1516
# admins are allowed to use their auth tokens to create global notifications.
1617
# examples would be notices about KBase downtime or events.

deployment/deploy.cfg.example

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ db-port=6379
1212
db-user=
1313
db-pw=
1414

15+
# Whether to enable ('true') the MongoDB retryWrites parameter or not (anything other than 'true').
16+
# See https://www.mongodb.com/docs/manual/core/retryable-writes/
17+
db-retrywrites=false
18+
1519
# Service urls
1620
auth-url=https://ci.kbase.us/services/auth
1721
workspace-url=https://ci.kbase.us/services/ws

feeds/config.py

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
KEY_DB_PW = "db-pw"
1616
KEY_DB_NAME = "db-name"
1717
KEY_DB_ENGINE = "db-engine"
18+
KEY_DB_RETRYWRITES = "db-retrywrites"
1819
KEY_GLOBAL_FEED = "global-feed"
1920
KEY_DEBUG = "debug"
2021
KEY_LIFESPAN = "lifespan"
@@ -60,6 +61,7 @@ def __init__(self):
6061
self.db_user = self._get_line(cfg, KEY_DB_USER, required=False)
6162
self.db_pw = self._get_line(cfg, KEY_DB_PW, required=False)
6263
self.db_name = self._get_line(cfg, KEY_DB_NAME, required=False)
64+
self.db_retrywrites = self._get_line(cfg, KEY_DB_RETRYWRITES, required=False) == "true"
6365
self.global_feed = self._get_line(cfg, KEY_GLOBAL_FEED)
6466
self.global_feed_type = "user" # doesn't matter, need a valid Entity type...
6567
try:

feeds/server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
log_error
3434
)
3535

36-
VERSION = "1.0.2"
36+
VERSION = "1.0.3"
3737

3838
try:
3939
from feeds import gitcommit

feeds/storage/mongodb/connection.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ def __init__(self):
9999
port=self.cfg.db_port,
100100
username=self.cfg.db_user,
101101
password=self.cfg.db_pw,
102+
retryWrites=self.cfg.db_retrywrites,
102103
authSource=self.cfg.db_name
103-
)
104+
)
104105
self.db = self.conn[self.cfg.db_name]
105106
self._setup_indexes()
106107
self._setup_schema()

test/test.cfg

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ service-narrative=narrativeservice
2020
service-jobs=jobsservice
2121
service-kbase=kbase
2222

23+
# Whether to enable ('true') the MongoDB retryWrites parameter or not (anything other than 'true').
24+
# See https://www.mongodb.com/docs/manual/core/retryable-writes/
25+
db-retrywrites=false
26+
2327
[test]
2428
mongo-exe=/usr/local/bin/mongod
2529
test-temp-dir=./test-temp-dir

0 commit comments

Comments
 (0)