Skip to content

Commit

Permalink
manage-consumers: Allow for subtyped consumers.
Browse files Browse the repository at this point in the history
This is immediately useful for commentstree_q but may also help if we
move vote_q procs onto a single box.
  • Loading branch information
spladug committed Jun 19, 2013
1 parent a27c63c commit bcea327
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions scripts/manage-consumers
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@

command=${UPSTART_JOB#reddit-consumers-}
for consumerpath in $REDDIT_CONSUMER_CONFIG/*; do
instance_count=$(cat $consumerpath)
consumer=$(basename $consumerpath)

# allow targeting which consumer the event is meant for (defaulting to 'all')
if [ ! -z "$TARGET" -a "x$TARGET" != "xall" -a "x$TARGET" != "x$consumer" ]; then
continue
fi

for i in $(seq 1 "$instance_count"); do
"/sbin/$command" "reddit-consumer-$consumer" "x=$i"
if [ -d $consumerpath ]; then
types=$consumerpath/*
else
types=$consumerpath
fi

for typepath in $types; do
instance_count=$(cat $typepath)
type_=$(basename $typepath)

for i in $(seq 1 "$instance_count"); do
"/sbin/$command" "reddit-consumer-$consumer" "type=$type_" "x=$i"
done
done
done

0 comments on commit bcea327

Please sign in to comment.