Skip to content

Commit

Permalink
change exchangeSplit to base hash on path
Browse files Browse the repository at this point in the history
  • Loading branch information
petersilva committed Dec 5, 2024
1 parent 06b92cc commit 9dfe06d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions sr_post.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,19 @@ void sr_post_message(struct sr_context *sr_c, struct sr_message_s *m)
strcpy(thisexchange, sr_c->cfg->post_broker->exchange);

if (sr_c->cfg->post_broker->exchangeSplit > 0) {
int tot=0;
char *basis=NULL;
if ( m->relPath ) { basis=m->relPath; }
// else if (m->retrievePath) { basis=m->retrievePath; }

tot=0;
if (basis) {
for (int i=0; i < strlen(basis); i++ ) {
tot += basis[i];
}
}
sprintf(strchr(thisexchange, '\0'), "%02d",
m->sum[sr_get_sumhashlen(m->sum[0]) -
1] % sr_c->cfg->post_broker->exchangeSplit);
tot % sr_c->cfg->post_broker->exchangeSplit);
}
status =
amqp_basic_publish(sr_c->cfg->post_broker->conn, 1,
Expand Down

0 comments on commit 9dfe06d

Please sign in to comment.