Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

# 1.1.6

- Add ability to update the polling interval of the IMAP sensor using configuration

# 1.1.5

- Add explicit support for Python 2 and 3
Expand Down
5 changes: 5 additions & 0 deletions config.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,8 @@ sensor_smtp_listen_port:
type: "integer"
required: false
default: 1025
email_polling_interval:
description: "Polling interval for IMAP sensor"
type: "integer"
required: false
default: 30
2 changes: 1 addition & 1 deletion pack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords:
- email
- messaging
- imap
version: 1.1.5
version: 1.1.6
author: James Fryman
email: james@stackstorm.com
python_versions:
Expand Down
6 changes: 4 additions & 2 deletions sensors/imap_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
DEFAULT_DOWNLOAD_ATTACHMENTS = False
DEFAULT_MAX_ATTACHMENT_SIZE = 1024
DEFAULT_ATTACHMENT_DATASTORE_TTL = 1800
DEFAULT_POLLING_INTERVAL = 30


class IMAPSensor(PollingSensor):
def __init__(self, sensor_service, config=None, poll_interval=30):
def __init__(self, sensor_service, config=None, poll_interval=DEFAULT_POLLING_INTERVAL):
super(IMAPSensor, self).__init__(sensor_service=sensor_service,
config=config,
poll_interval=poll_interval)
poll_interval=self._config.get('email_polling_interval',
poll_interval))

self._trigger = 'email.imap.message'
self._logger = self._sensor_service.get_logger(__name__)
Expand Down