Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.0.6 #41

Merged
merged 2 commits into from
Dec 12, 2023
Merged
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: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on: [ push ]
on: [ push, pull_request ]

env:
CI: true
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- master
paths:
- package.json

env:
CI: true
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ jspm_packages
.node_repl_history

package-lock.json
bower_components
# Optional npm cache directory
.npmrc
.idea
.DS_Store
haraka-update.sh
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule ".release"]
path = .release
url = [email protected]:msimerson/.release.git
56 changes: 50 additions & 6 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,58 @@
.github
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

package-lock.json
bower_components
# Optional npm cache directory
.npmrc
.idea
.DS_Store
haraka-update.sh

.github
.release
.codeclimate.yml
.editorconfig
.gitignore
.gitmodules
.lgtm.yml
http/bower_components
http/node_modules
.travis.yml
appveyor.yml
codecov.yml
.travis.yml
.eslintrc.yaml
.eslintrc.json
codecov.yml
.codeclimate.yml
1 change: 1 addition & 0 deletions .release
Submodule .release added at 0890e9
9 changes: 9 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

### Unreleased


### [2.0.6] - 2023-12-12

- doc(README): '[socket]' is now '[server]' (#39)
- chore(ci): add .release, updated dot files


### 2.0.5 - 2022-05-26

Expand Down Expand Up @@ -83,3 +91,4 @@

- don't break when no [redis] config exists

[2.0.6]: https://github.com/haraka/haraka-plugin-redis/releases/tag/2.0.6
12 changes: 8 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ exports.redis_ping = async function () {
const r = await this.db.ping()
if (r !== 'PONG') throw new Error('not PONG');
this.redis_pings=true

return true
}

Expand Down Expand Up @@ -193,6 +194,7 @@ exports.get_redis_client = async function (opts) {
}
}


exports.get_redis_pub_channel = function (conn) {
return `result-${conn.transaction ? conn.transaction.uuid : conn.uuid}`;
}
Expand All @@ -201,18 +203,20 @@ exports.get_redis_sub_channel = function (conn) {
return `result-${conn.uuid}*`;
}

exports.redis_subscribe_pattern = async function (pattern) {
// formerly used by pi-watch
exports.redis_subscribe_pattern = async function (pattern, onMessage) {

if (this.redis) return // already subscribed?

this.redis = redis.createClient(this.redisCfg.pubsub)
await this.redis.connect()

await this.redis.pSubscribe(pattern);
await this.redis.pSubscribe(pattern, onMessage);
this.logdebug(this, `pSubscribed to ${pattern}`);
}

exports.redis_subscribe = async function (connection) {
// the next two functions are use by pi-karma
exports.redis_subscribe = async function (connection, onMessage) {

if (connection.notes.redis) {
connection.logdebug(this, `redis already subscribed`);
Expand All @@ -229,7 +233,7 @@ exports.redis_subscribe = async function (connection) {
clearTimeout(timer);

const pattern = this.get_redis_sub_channel(connection)
connection.notes.redis.pSubscribe(pattern);
connection.notes.redis.pSubscribe(pattern, onMessage);
connection.logdebug(this, `pSubscribed to ${pattern}`);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "haraka-plugin-redis",
"version": "2.0.5",
"version": "2.0.6",
"description": "Redis plugin for Haraka & other plugins to inherit from",
"main": "index.js",
"directories": {
Expand Down