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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ upcoming([option] [, cb]) => {Promise}

### Event types

#### Event: 'ready' - Emitted when the module is ready to process events.

#### Event: 'event' - Emitted when an event is received.
The handler will be called with the following argument:

Expand Down
1 change: 1 addition & 0 deletions lib/dtimer.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function DTimer(id, pub, sub, option) {
return;
}
debug(self._id+': lua loading successful');
self.emit('ready');
});
this._maxEvents = this._option.maxEvents;

Expand Down
8 changes: 8 additions & 0 deletions test/ApiTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ describe('ApiTests', function () {
});
});

it('emits ready after redis is setup successfully', function (done) {
var pub = redis.createClient();
var dt = new DTimer('me', pub, null);
dt.on('ready', function () {
done();
});
});

it('Detect malformed message on subscribe', function (done) {
sandbox.stub(require('lured'), 'create', function () {
return {
Expand Down