feat: subscribe to RabbitMQ trade signals and notify by rules

Consume configurable queues, format signals (including period), share NotifyService with HTTP, and drop duplicate bodies within 1h.
This commit is contained in:
2026-08-15 17:34:49 +08:00
parent 1f4fe2fb75
commit 6f846a0a3c
25 changed files with 3129 additions and 114 deletions
+12
View File
@@ -175,3 +175,15 @@ func (c *Cache) CheckRateLimit(ctx context.Context, sourceID int, limitPerSec in
func (c *Cache) Close() error {
return c.rdb.Close()
}
func dedupKey(hash string) string {
return "notify:dedup:" + hash
}
func (c *Cache) ClaimDedup(ctx context.Context, hash string, ttl time.Duration) (bool, error) {
return c.rdb.SetNX(ctx, dedupKey(hash), "1", ttl).Result()
}
func (c *Cache) ReleaseDedup(ctx context.Context, hash string) error {
return c.rdb.Del(ctx, dedupKey(hash)).Err()
}