fix s3 thing status (#14925)
Signed-off-by: Alexandr Salamatov <goopilot@gmail.com>
This commit is contained in:
parent
3130a67d8d
commit
dc5d76d762
|
@ -115,7 +115,7 @@ public class S3Actions {
|
||||||
List<String> returnList = new ArrayList<>();
|
List<String> returnList = new ArrayList<>();
|
||||||
|
|
||||||
if (nameNodesList.getLength() == 0) {
|
if (nameNodesList.getLength() == 0) {
|
||||||
throw new Exception("No files deceted in the bucket");
|
return returnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nameNodesList.getLength(); i++) {
|
for (int i = 0; i < nameNodesList.getLength(); i++) {
|
||||||
|
|
|
@ -89,7 +89,6 @@ public class S3BucketWatcherHandler extends BaseThingHandler {
|
||||||
|
|
||||||
if (refreshS3BucketInformation()) {
|
if (refreshS3BucketInformation()) {
|
||||||
if (config.pollIntervalS3 > 0) {
|
if (config.pollIntervalS3 > 0) {
|
||||||
updateStatus(ThingStatus.ONLINE);
|
|
||||||
executionJob = scheduler.scheduleWithFixedDelay(this::refreshS3BucketInformation, config.pollIntervalS3,
|
executionJob = scheduler.scheduleWithFixedDelay(this::refreshS3BucketInformation, config.pollIntervalS3,
|
||||||
config.pollIntervalS3, TimeUnit.SECONDS);
|
config.pollIntervalS3, TimeUnit.SECONDS);
|
||||||
} else {
|
} else {
|
||||||
|
@ -104,6 +103,7 @@ public class S3BucketWatcherHandler extends BaseThingHandler {
|
||||||
List<String> currentS3Listing = new ArrayList<>();
|
List<String> currentS3Listing = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
currentS3Listing = s3.listBucket(config.s3Path);
|
currentS3Listing = s3.listBucket(config.s3Path);
|
||||||
|
updateStatus(ThingStatus.ONLINE);
|
||||||
List<String> difS3Listing = new ArrayList<>(currentS3Listing);
|
List<String> difS3Listing = new ArrayList<>(currentS3Listing);
|
||||||
difS3Listing.removeAll(previousS3Listing);
|
difS3Listing.removeAll(previousS3Listing);
|
||||||
difS3Listing.forEach(file -> triggerChannel(CHANNEL_NEWFILE, file));
|
difS3Listing.forEach(file -> triggerChannel(CHANNEL_NEWFILE, file));
|
||||||
|
|
Loading…
Reference in New Issue