Skip to content

Commit 2bfc0ea

Browse files
authored
Increased timeout for requests against ChirpStack application server (#124)
1 parent ba7e1ce commit 2bfc0ea

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/services/chirpstack/generic-chirpstack-configuration.service.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ export class GenericChirpstackConfigurationService {
3030
private readonly innerLogger = new Logger(GenericChirpstackConfigurationService.name);
3131

3232
setupHeader(endPoint: string, limit?: number, offset?: number): HeaderDto {
33-
if (limit != null && offset != null) {
34-
const headerDto: HeaderDto = {
35-
url: `${this.baseUrl}/api/${endPoint}${
36-
endPoint.indexOf("?") >= 0 ? "&" : "?"
37-
}limit=${limit}&offset=${offset}`,
38-
timeout: 3000,
39-
authorizationType: AuthorizationType.HEADER_BASED_AUTHORIZATION,
40-
authorizationHeader: "Bearer " + JwtToken.setupToken(),
41-
};
42-
return headerDto;
33+
// Default timeout value in ms
34+
const timeout = 30000;
35+
let url = this.baseUrl + "/api/" + endPoint;
36+
37+
// If limits are supplied, add these as query params
38+
if (limit != null && offset != null) {
39+
url += `${endPoint.indexOf("?") >= 0 ? "&" : "?"
40+
}limit=${limit}&offset=${offset}`;
4341
}
44-
const headerDto: HeaderDto = {
45-
url: this.baseUrl + "/api/" + endPoint,
46-
timeout: 3000,
42+
43+
let headerDto: HeaderDto = {
44+
url,
45+
timeout,
4746
authorizationType: AuthorizationType.HEADER_BASED_AUTHORIZATION,
4847
authorizationHeader: "Bearer " + JwtToken.setupToken(),
4948
};
49+
5050
return headerDto;
5151
}
5252

0 commit comments

Comments
 (0)