Skip to content

Commit

Permalink
Merge tag '3.38.0' into develop
Browse files Browse the repository at this point in the history
Release 3.38.0
  • Loading branch information
msqr committed Oct 30, 2024
2 parents 403742c + 6ce17c2 commit 9edb86b
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 27 deletions.
2 changes: 1 addition & 1 deletion solarnet/cloud-integrations/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencyManagement {
}

description = 'SolarNet: Cloud Integrations'
version = '1.7.0'
version = '1.8.0'

base {
archivesName = 'solarnet-cloud-integrations'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.support.PeriodicTrigger;
import org.springframework.scheduling.support.SimpleTriggerContext;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestClientResponseException;
import net.solarnetwork.central.biz.UserEventAppenderBiz;
import net.solarnetwork.central.c2c.biz.CloudDatumStreamPollService;
import net.solarnetwork.central.c2c.biz.CloudDatumStreamService;
Expand Down Expand Up @@ -226,15 +225,8 @@ public CloudDatumStreamPollTaskEntity call() throws Exception {
var oldState = taskInfo.getState();
taskInfo.setMessage(errMsg);
taskInfo.putServiceProps(errData);
if ( !((e instanceof RestClientException && !(e instanceof HttpClientErrorException))
|| t instanceof IOException) ) {
// stop processing job if not what appears to be a API IO exception
log.info(
"Stopping datum stream {} poll task by changing state from {} to {} after error: {}",
taskInfo.getId().ident(), oldState, Completed, e.toString());
taskInfo.setState(Completed);
} else {
// reset back to queued to try again
if ( t instanceof RestClientResponseException || t instanceof IOException ) {
// reset back to queued to try again if HTTP client or IO error
log.info(
"Resetting datum stream {} poll task by changing state from {} to {} after error: {}",
taskInfo.getId().ident(), oldState, Queued, e.toString());
Expand All @@ -244,6 +236,12 @@ public CloudDatumStreamPollTaskEntity call() throws Exception {
// bump date into future by 1 minute so we do not immediately try to process again
taskInfo.setExecuteAt(clock.instant().plusSeconds(60));
}
} else {
// stop processing job if not what appears to be a API IO exception
log.info(
"Stopping datum stream {} poll task by changing state from {} to {} after error: {}",
taskInfo.getId().ident(), oldState, Completed, e.toString());
taskInfo.setState(Completed);
}
userEventAppenderBiz.addEvent(taskInfo.getUserId(),
eventForConfiguration(taskInfo.getId(), POLL_ERROR_TAGS, errMsg, errData));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.springframework.http.ResponseEntity;
import org.springframework.security.crypto.encrypt.TextEncryptor;
import org.springframework.security.oauth2.core.OAuth2AuthorizationException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.ResourceAccessException;
import org.springframework.web.client.RestClientResponseException;
import org.springframework.web.client.RestOperations;
Expand All @@ -54,7 +55,7 @@
* Helper for HTTP interactions using {@link RestOperations}.
*
* @author matt
* @version 1.3
* @version 1.4
*/
public class RestOperationsHelper implements CloudIntegrationsUserEvents {

Expand Down Expand Up @@ -220,17 +221,34 @@ public <B, R, C extends CloudIntegrationsConfigurationEntity<C, K>, K extends Us
throw new RemoteServiceException("%s failed because an invalid HTTP status was returned: %s"
.formatted(description, e.getStatusCode()), e);
} catch ( UnknownContentTypeException e ) {
log.warn(
"[{}] for {} {} failed at [{}] because the response Content-Type [{}] is not supported.",
configuration.getClass().getSimpleName(), configuration.getId().ident(), uri,
e.getContentType());
userEventAppenderBiz.addEvent(configuration.getUserId(),
eventForConfiguration(configuration, errorEventTags,
format("Invalid HTTP Content-Type returned: %s", e.getContentType())));
throw new RemoteServiceException(
"%s failed because the respones Content-Type is not supported: %s"
.formatted(description, e.getContentType()),
e);
if ( e.getStatusCode().is4xxClientError() ) {
// we see some APIs return text/html on a 404, but our Accept might only expect something like JSON
// so treat this more like a RestClientResponseException
log.warn(
"[{}] for {} {} failed at [{}] because the HTTP status {} was returned (with unexpected Content-Type [{}]).",
description, configuration.getClass().getSimpleName(),
configuration.getId().ident(), uri, e.getStatusCode(), e.getContentType());
userEventAppenderBiz.addEvent(configuration.getUserId(),
eventForConfiguration(configuration, errorEventTags,
format("Invalid HTTP status returned: %s", e.getStatusCode())));
throw new RemoteServiceException(
"%s failed because an invalid HTTP status (with unexpected Content-Type [{}]) was returned: %s"
.formatted(description, e.getContentType(), e.getStatusCode()),
new HttpClientErrorException(e.getMessage(), e.getStatusCode(),
e.getStatusText(), e.getResponseHeaders(), e.getResponseBody(), null));
} else {
log.warn(
"[{}] for {} {} failed at [{}] because the response Content-Type [{}] is not supported.",
configuration.getClass().getSimpleName(), configuration.getId().ident(), uri,
e.getContentType());
userEventAppenderBiz.addEvent(configuration.getUserId(),
eventForConfiguration(configuration, errorEventTags,
format("Invalid HTTP Content-Type returned: %s", e.getContentType())));
throw new RemoteServiceException(
"%s failed because the respones Content-Type is not supported: %s"
.formatted(description, e.getContentType()),
e);
}
} catch ( OAuth2AuthorizationException e ) {
log.warn("[{}] for {} {} failed at [{}] because of an OAuth error: {}",
configuration.getClass().getSimpleName(), configuration.getId().ident(), uri,
Expand Down
2 changes: 1 addition & 1 deletion solarnet/solarjobs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

description = 'SolarJobs'
version = '2.16.0'
version = '2.17.0'

base {
archivesName = 'solarjobs'
Expand Down
2 changes: 1 addition & 1 deletion solarnet/solaruser/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

description = 'SolarUser'
version = '2.25.0'
version = '2.26.0'

base {
archivesName = 'solaruser'
Expand Down
2 changes: 1 addition & 1 deletion solarnet/user-cloud-integrations/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencyManagement {
}

description = 'SolarNet: User Cloud Integrations'
version = '1.4.0'
version = '1.4.1'

base {
archivesName = 'solarnet-user-cloud-integrations'
Expand Down

0 comments on commit 9edb86b

Please sign in to comment.