mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-08 05:31:56 +00:00
fixed the scheduling from throwing exceptions because it was using parenthesis when passing the handler method in to the scheduling method; ensured that the scheduler doesn't send empty events
This commit is contained in:
@@ -167,10 +167,6 @@ def subscribeToEvents() {
|
||||
if (waterSensors != null) {
|
||||
subscribe(waterSensors, "water", genericHandler)
|
||||
}
|
||||
|
||||
if (canSchedule()) {
|
||||
runEvery15Minutes(flushBuffer())
|
||||
}
|
||||
}
|
||||
|
||||
def getAccessKey() {
|
||||
@@ -235,6 +231,8 @@ def installed() {
|
||||
atomicState.grokerSubdomain = "groker"
|
||||
atomicState.eventBuffer = [];
|
||||
|
||||
runEvery15Minutes(flushBuffer)
|
||||
|
||||
log.debug "installed (version $atomicState.version)"
|
||||
}
|
||||
|
||||
@@ -317,7 +315,8 @@ def genericHandler(evt) {
|
||||
// This is a handler function for flushing the event buffer
|
||||
// after a specified amount of time to reduce the load on ST servers
|
||||
def flushBuffer() {
|
||||
if (atomicState.eventBuffer.size() > 0) {
|
||||
log.trace "About to flush the buffer on schedule"
|
||||
if (atomicState.eventBuffer != null && atomicState.eventBuffer.size() > 0) {
|
||||
shipEvents();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user