Skip to content

Commit

Permalink
There's no practical reason to name it destroy() instead of delete().
Browse files Browse the repository at this point in the history
Now the client API matches the beanstalks commands without exception.
  • Loading branch information
ceejbot committed Feb 5, 2012
1 parent 155fc5b commit 8727589
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions README.md
Expand Up @@ -4,7 +4,7 @@ A straightforward and (nearly) complete [beanstalkd](http://kr.github.com/beanst

Heavily inspired by [node-beanstalk-client](https://github.com/benlund/node-beanstalk-client), which is a perfectly usable client but somewhat dusty. I wanted more complete support of the beanstalkd protocol in a project written in plain javascript.

All client method names are the same case & spelling as the beanstalk text command, with hyphens replaced by underscore. The single exception is 'delete', which is called as "destroy()".
All client method names are the same case & spelling as the beanstalk text command, with hyphens replaced by underscore.

For complete details on the beanstalkd commands, see [its protocol documentation](https://github.com/kr/beanstalkd/blob/master/doc/protocol.txt).

Expand Down Expand Up @@ -96,11 +96,11 @@ Reserve a job, waiting the specified number of seconds before timing out. *err*

Inform the server that the client is still processing a job, thus requesting more time to work on it.

#### destroy/delete
#### delete

`client.destroy(jobid, function(err) {});`
`client.delete(jobid, function(err) {});`

Delete the specified job. Responds with null if successful, a string error otherwise. This is the only method without a name identical to the underlying beanstalkd command. The equivalent is `delete`.
Delete the specified job. Responds with null if successful, a string error otherwise.

#### release

Expand Down Expand Up @@ -262,14 +262,14 @@ logdir: "/path/to/log"
ignoreDefault: true
```

You may omit the __logdir__ line to suppress logging to a file.

__beanstalkd__: where to connect
__watch__: a list of tubes to watch.
__handlers__: a list of handler files to require
__logdir__: path to the directory for worker logs
__ignoreDefault__: true if this worker should ignore the default tube

You may omit the __logdir__ line to suppress logging to a file.

If the handler paths don't start with `/` the current working directory will be prepended to them before they are required.

## TODO
Expand Down
2 changes: 1 addition & 1 deletion lib/client.js
Expand Up @@ -204,7 +204,7 @@ FiveBeansClient.prototype.watch = makeBeanstalkCommand('watch', 'WATCHING');
FiveBeansClient.prototype.ignore = makeBeanstalkCommand('ignore', 'WATCHING');
FiveBeansClient.prototype.reserve = makeBeanstalkCommand('reserve', 'RESERVED');
FiveBeansClient.prototype.reserve_with_timeout = makeBeanstalkCommand('reserve-with-timeout', 'RESERVED');
FiveBeansClient.prototype.destroy = makeBeanstalkCommand('delete', 'DELETED');
FiveBeansClient.prototype.delete = makeBeanstalkCommand('delete', 'DELETED');
FiveBeansClient.prototype.release = makeBeanstalkCommand('release', 'RELEASED');
FiveBeansClient.prototype.bury = makeBeanstalkCommand('bury', 'BURIED');
FiveBeansClient.prototype.touch = makeBeanstalkCommand('touch', 'TOUCHED');
Expand Down
8 changes: 4 additions & 4 deletions lib/worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions test/test.js
Expand Up @@ -206,13 +206,13 @@ describe('FiveBeansClient', function()
});
});
});
it('#destroy deletes a job', function(done)
it('#delete deletes a job', function(done)
{
// this takes a couple of seconds because of the minumum delay enforced by pause_tube() above
this.timeout(5000);
consumer.reserve(function(err, jobid, payload)
{
consumer.destroy(jobid, function(err)
consumer.delete(jobid, function(err)
{
should.not.exist(err);
done();
Expand Down

0 comments on commit 8727589

Please sign in to comment.