OS2iot / OS2iot-backend

This repository contains the backend to the project OS2iot.
Mozilla Public License 2.0
10 stars 7 forks source link

Optimize chirpstack calls when fetching devices #143

Closed AramAlsabti closed 2 years ago

AramAlsabti commented 2 years ago

Related to this issue on the frontend. When fetching application devices, a requests are made to the chirpstack API for each LoRaWAN device. These are dispatched without waiting. In most scenarios, a user fetches 20 devices. If most, or all, devices are of type LoRaWAN, then that results in a lot of "parallel" calls to chirpstack.

In most scenarios, LoRaWAN devices in an OS2IoT application are in the same chirpstack application. Therefore, this PR groups these devices by application ids and pre-fetches the chirpstack applications. Calls to chirpstack are also executed sequentially

AramAlsabti commented 2 years ago

This PR assumes that the related issue stems from a heavy load on chirpstack. Therefore, merging this PR won't close the issue until it's been tested with a proper test setup