cablelabs / lpwanserver

LPWAN Provisioning & Management Server
https://lpwanserver.com
Apache License 2.0
37 stars 11 forks source link

Issue 269 #304

Closed rhythnic closed 5 years ago

rhythnic commented 5 years ago

What does this PR do?

Do you have any concerns with this PR?

IP device messages need to be tested and web-client needs to be updated.

How can the reviewer verify this PR?

Run tests

Any background context you want to provide?

Right now the device's IP/port and a timestamp are being cached in Redis, as well as a message queue for messages that can't go out yet to NB-IoT devices. I chose to use a connectionDuration setting in the DeviceProfile, which if set, will determine how long after the LPWAN Server receives an uplink from an IP device it is able to send a downlink message. If duration has passed, all queued messages will be sent as separate requests after the next uplink.

There are serveral DB hits on an IP device uplink:

Caching any of these would also mean listening to changes from Prisma to make sure the cache isn't stale. The effort to do this one use case would be similar to implementing a more generic DB caching solution. There are many redundant DB reads in the LoRa network push/pull flows. After testing IP devices I'll work on a generic DB caching solution.

The network protocol handlers were behind the network protocol API, which assumes there's a network. I exposed the handlers at the model level to make them available to device types without networks.

I refactored a bit so that LoRa Server and LPWAN Server could share a development instances of Postgresql, without public schema collisions, and Redis.

Screenshots or logs (if appropriate)

Questions: