I have been trying the aws_iot sample in nRF Connect SDK v2.7.0 for build target nrf7002dk/nrf5340/cpuapp, in which connect_work is scheduled with a 5 second delay in the function on_net_event_l4_connected. What is the purpose of this delay?
As a test I have tried replacing the 5 second delay with K_NO_WAIT, and noticed that aws_iot_connect returns error -116 with an increased rate (although this error also occasionally happens with the K_SECONDS(5) delay), is this the reason for the 5 second delay? Is it recommended to always have some amount delay between a NET_EVENT_L4_CONNECTED event and calling aws_iot_connect?