fix s3 thing status (#14925)

Signed-off-by: Alexandr Salamatov <goopilot@gmail.com>
This commit is contained in:
goopilot 2023-05-03 01:10:46 -05:00 committed by GitHub
parent 3130a67d8d
commit dc5d76d762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -115,7 +115,7 @@ public class S3Actions {
List<String> returnList = new ArrayList<>();
if (nameNodesList.getLength() == 0) {
throw new Exception("No files deceted in the bucket");
return returnList;
}
for (int i = 0; i < nameNodesList.getLength(); i++) {

View File

@ -89,7 +89,6 @@ public class S3BucketWatcherHandler extends BaseThingHandler {
if (refreshS3BucketInformation()) {
if (config.pollIntervalS3 > 0) {
updateStatus(ThingStatus.ONLINE);
executionJob = scheduler.scheduleWithFixedDelay(this::refreshS3BucketInformation, config.pollIntervalS3,
config.pollIntervalS3, TimeUnit.SECONDS);
} else {
@ -104,6 +103,7 @@ public class S3BucketWatcherHandler extends BaseThingHandler {
List<String> currentS3Listing = new ArrayList<>();
try {
currentS3Listing = s3.listBucket(config.s3Path);
updateStatus(ThingStatus.ONLINE);
List<String> difS3Listing = new ArrayList<>(currentS3Listing);
difS3Listing.removeAll(previousS3Listing);
difS3Listing.forEach(file -> triggerChannel(CHANNEL_NEWFILE, file));