Repository navigation
feat(interfaces): queue redis writes by default at 0.1s interval #4015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c2c42d3
feat(interfaces): queue redis writes by default at 0.1s interval
jmthomas c33c1a8
fix(review): apply Claude review fixes (turn 1)
github-actions[bot] e91e1c1
fix(review): apply Codex review fixes (turn 2)
github-actions[bot] 9459f19
Merge pull request #4030 from OpenC3/ai-review/pr-4015-38000332622
jmthomas 55ee931
Merge branch 'main' into interface_queued_default
jmthomas 9ce0cf7
docs(interfaces): clarify UPDATE_INTERVAL only queues raw stream writes
jmthomas d669187
Merge branch 'main' into interface_queued_default
jmthomas 637b19f
fix(interfaces): apply update interval to lazily created telemetry sh…
jmthomas 7b7a2f8
Merge remote-tracking branch 'origin/main' into interface_queued_default
jmthomas 9faf3b8
fix(store): apply interface UPDATE_INTERVAL to every db shard
jmthomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Copyright 2026 OpenC3, Inc. | ||
| # All Rights Reserved. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| # See LICENSE.md for more details. | ||
| # | ||
| # This file may also be used under the terms of a commercial license | ||
| # if purchased from OpenC3, Inc. | ||
|
|
||
| import datetime | ||
| import unittest | ||
| from unittest.mock import MagicMock, patch | ||
|
|
||
| from openc3.packets.packet import Packet | ||
| from openc3.topics.telemetry_topic import TelemetryTopic | ||
| from test.test_helper import mock_redis | ||
|
|
||
|
|
||
| class TestTelemetryTopic(unittest.TestCase): | ||
| def setUp(self): | ||
| mock_redis(self) | ||
| shard_patch = patch("openc3.topics.telemetry_topic.Store.db_shard_for_target", return_value=3) | ||
| shard_patch.start() | ||
| self.addCleanup(shard_patch.stop) | ||
|
|
||
| self.packet = Packet("TARGET", "PACKET") | ||
| self.packet.received_time = datetime.datetime.now(datetime.timezone.utc) | ||
| self.packet.packet_time = datetime.datetime.now(datetime.timezone.utc) | ||
| self.packet.received_count = 1 | ||
|
|
||
| @patch("openc3.topics.telemetry_topic.EphemeralStoreQueued.instance") | ||
| def test_writes_to_queued_store_for_target_shard(self, instance): | ||
| instance.return_value = MagicMock() | ||
| TelemetryTopic.write_packet(self.packet, queued=True, scope="DEFAULT") | ||
| instance.assert_called_once_with(db_shard=3) | ||
| topic, msg_hash = instance.return_value.write_topic.call_args.args | ||
| self.assertEqual(topic, "DEFAULT__TELEMETRY__{TARGET}__PACKET") | ||
| self.assertEqual(msg_hash["target_name"], "TARGET") | ||
|
|
||
| @patch("openc3.topics.telemetry_topic.Topic.write_topic") | ||
| @patch("openc3.topics.telemetry_topic.EphemeralStoreQueued.instance") | ||
| def test_writes_directly_to_target_shard_when_not_queued(self, instance, write_topic): | ||
| TelemetryTopic.write_packet(self.packet, scope="DEFAULT") | ||
| instance.assert_not_called() | ||
| self.assertEqual(write_topic.call_args.args[0], "DEFAULT__TELEMETRY__{TARGET}__PACKET") | ||
| self.assertEqual(write_topic.call_args.kwargs["db_shard"], 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.