DPIclimate / DPIclimate/broker

Cache device mapping entries in the logical mapper

Open
#8 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
3
Forks
3
Avg merge
3m
Merged PRs (30d)
1

Description

The logical mapper could cache the current device mappings in memory as they are read from the database.

A database notification could be used as a signal to flush the cache when the mapping table is updated.

The logical mapper has an idle loop that sleeps for 2 seconds at a time while waiting for RabbitMQ messages or a signal to shut down so that can be used to poll the DB signal. The DB can include the physical device id in the notification so the logical mapper only discards the entry for that device.

There is a race condition where a message is delivered slightly out of sync with the DB notification but with the low message volumes we experience it probably isn't much to worry about.

However, if we're issuing a query every few seconds looking for DB notifications, that may be more load on the DB than what we have now with the low volume of traffic.

Special consideration must be made for older messages if issue #7 is implemented.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the logical mapper, its database mapping reads, and the idle loop that waits for RabbitMQ messages or shutdown signals. Review how database notifications and physical device IDs are exposed, then define done as reusing current mappings, invalidating affected entries after updates, and accounting for older messages if issue #7 is implemented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rabbitmq
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.