Skip to content
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
32 changes: 29 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,35 @@ jobs:
sudo apt update
sudo apt-get install -y --fix-missing redis-server
sudo service redis-server stop
redis-server --daemonize yes --port 7000 --appendonly yes --cluster-enabled yes --cluster-config-file nodes-7000.conf
redis-server --daemonize yes --port 7001 --appendonly yes --cluster-enabled yes --cluster-config-file nodes-7001.conf
redis-server --daemonize yes --port 7002 --appendonly yes --cluster-enabled yes --cluster-config-file nodes-7002.conf

# Every node needs its own data directory. Sharing one means sharing a
# single `appendonlydir`, and three servers creating that AOF manifest
# at the same time is enough to make one of them die on startup.
for port in 7000 7001 7002; do
mkdir -p "$RUNNER_TEMP/redis-$port"
redis-server --daemonize yes --port "$port" --appendonly yes --cluster-enabled yes \
--cluster-config-file "nodes-$port.conf" \
--dir "$RUNNER_TEMP/redis-$port" \
--logfile "$RUNNER_TEMP/redis-$port/redis.log"
done

# --daemonize returns as soon as the parent forks, before the node
# accepts connections, so creating the cluster straight away races
# the last node into a refused connection. Wait for every node to
# answer PING first.
for port in 7000 7001 7002; do
for attempt in $(seq 30); do
if [ "$(redis-cli -p "$port" ping 2>/dev/null)" = "PONG" ]; then
continue 2
fi
sleep 1
done

echo "Redis node on port $port never started accepting connections. Its log:"
cat "$RUNNER_TEMP/redis-$port/redis.log" || true
exit 1
done

redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 --cluster-replicas 0 --cluster-yes

- name: Check Redis Cluster is ready
Expand Down
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
"@build",
"@php vendor/bin/testbench serve"
],
"serve:demo": [
"Composer\\Config::disableProcessTimeout",
"@putenv HORIZONXBRAIN_FLOW_SOURCE=mock",
"@build",
"@php vendor/bin/testbench serve"
],
"lint": [
"@php vendor/bin/phpstan analyse"
],
Expand Down
2 changes: 1 addition & 1 deletion dist/app.js

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions resources/js/screens/live-flow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,8 @@
const midY = H / 2;

const queues = this.filteredQueues.map((queue, i) => {
const node = this.findQueueNode(queue);
return {
id: node?.id ?? this.queueNodeId(queue),
id: this.queueGraphId(queue),
type: 'queue', label: queue.name, sub: this.queueSubLabel(queue),
status: this.queueStatus(queue),
x: 205, y: this.distributedY(i, this.filteredQueues.length, qYMin, qYMax),
Expand Down Expand Up @@ -324,7 +323,7 @@
let jobClass = null;

if (node.type === 'job') {
queue = this.queues.find(q => this.queueNodeId(q) === node.queueId) ?? null;
queue = this.queues.find(q => this.queueGraphId(q) === node.queueId) ?? null;
if (queue) {
jobClass = this.queueJobClasses(queue).find(c => c.name === node.name) ?? null;
}
Expand Down Expand Up @@ -674,7 +673,7 @@

queueJobNodes() {
return this.filteredQueues.flatMap(queue => {
const queueId = this.queueNodeId(queue);
const queueId = this.queueGraphId(queue);

if (this.zoom >= 1.35) {
return (queue.jobs ?? [])
Expand Down Expand Up @@ -806,6 +805,14 @@
return `queue-${queue.driver}-${queue.connection}-${queue.name}`.replace(/[^a-z0-9-]+/gi, '-').toLowerCase();
},

// The graph node id a queue actually renders under: the backend's id
// when the payload carries one, otherwise the local fallback. Job
// nodes and the inspector must resolve queues through the same id,
// or their edges never connect to the queue they belong to.
queueGraphId(queue) {
return this.findQueueNode(queue)?.id ?? this.queueNodeId(queue);
},

queueStatus(queue) {
if (this.queueFailedInWindow(queue) > 0) return 'critical';
if (queue.wait_seconds >= 30 || queue.pending >= 500) return 'critical';
Expand Down
Loading
Loading