there is a classBScheduleMargin (5 senconds) in networkserver.go
It will delay the class B downlink.
The question
1、what is the margin time protect for?
2、why 5 sencond? not 3 sencond …etc
3、I want to shorten the margin time,can you please give me some advise?
// classBScheduleMargin contains a Class-B scheduling margin to make sure
// there is enough time between scheduling and the actual Class-B ping-slot.
const classBScheduleMargin = 5 * time.Second
Note that the enqueuing and the scheduler (reading from the DB and sending to the gateway) are two processes. So if you lower this margin, it could mean that the downlink is enqueued for a ping-slot before the scheduler is able to send it to the gateway on that slot.
3、I want to shorten the margin time,can you please give me some advise?
Feel free to create a pull-request to make this config variable adjustable. I think it makes sense to add this margin under the [network_server.network_settings.class_b] config section.
No, the config value is currently defined as a constant. In case you would like to make it adjustable, I suggest you create a pull-request with the code modification to make this a configuration option See https://www.loraserver.io/loraserver/install/config/ for the loraserver.toml configuration.
This value is a pessimistic value to make sure that there is plenty of time for the scheduler to pick this up Probably 4 seconds could have worked too, or maybe even 3. Therefore I think it is good to make this in a config value, so people are free to tweak this to their needs. If you would like to make this value configurable, that would be much appreciated!