Comments (1)
Hi @rectof I have recently started using rmq as well and I am doing a couple of things.
- Share redis client between connections rather than getting new client for each connection to the queue. This should reduce number of connected clients to redis.
var connection rmq.Connection
opt, _ := redis.ParseURL(url)
opt.MaxRetries = 5
redis_client = redis.NewClient(opt)
func OpenConnection(url string) {
redisConn := rmq.OpenConnectionWithRedisClient("heartbeat", redis_client)
connection = redisConn
go func() {
cleaner := rmq.NewCleaner(redisConn)
for range time.Tick(time.Second) {
err := cleaner.Clean()
if err != nil {
sentry.CaptureException(err)
}
}
}()
}
- Stop the connection heartbeat once done with the work so that cleaner can clean the connection.
In my case I stop the heartbeat of the connection which are using just once for publishing to the queue.
connection.StopHeartbeat()
Hope this helps. Please share if you come across more ideas.
from rmq.
Related Issues (20)
- Trying to use rmq against a clustered Redis/Elasticcache Db. keep getting the "MOVED" error. HOT 8
- question? HOT 1
- redis cluster - CROSSSLOT error HOT 28
- When cleaner will move unacked queue to ready queue? HOT 2
- Propagating Context HOT 4
- [Question] How to process unacked tasks? HOT 7
- Add Support for sharing rmq Queues across multiple Connections HOT 3
- delay queue function HOT 1
- Is the queue thread-safe? HOT 1
- Any plan to implement BufferedQueue? HOT 2
- How to ensure that the writing and consumption of messages are ordered? HOT 1
- Delivery Ack/Reject fails when header is used
- Readme seems outdate, there is no need for errChan now HOT 1
- heartbeat is not stopped HOT 2
- update the redis sdk HOT 3
- Differentiate between Reject, Ack, Push errors in DeliveryError HOT 6
- Ability to remove/cancel task HOT 4
- Is there task aggregating in rmq? HOT 4
- consumer not work HOT 4
- Do Consumers work in parallel? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rmq.