add emqx creds creation to go routine

This commit is contained in:
abhishek9686 2024-03-25 01:09:28 +07:00
parent 60e5951dba
commit c8e65f4820

View file

@ -553,7 +553,7 @@ func authenticateHost(response http.ResponseWriter, request *http.Request) {
logic.ReturnErrorResponse(response, request, errorResponse)
return
}
go func() {
// Create EMQX creds and ACLs if not found
if servercfg.GetBrokerType() == servercfg.EmqxBrokerType {
if err := mq.GetEmqxHandler().CreateEmqxUser(host.ID.String(), authRequest.Password); err != nil {
@ -573,6 +573,7 @@ func authenticateHost(response http.ResponseWriter, request *http.Request) {
}
}
}
}()
response.WriteHeader(http.StatusOK)
response.Header().Set("Content-Type", "application/json")