Skip to content

Commit

Permalink
Fix swoole server on request param. (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmjoy authored Nov 9, 2023
1 parent 3f44db4 commit 981dad9
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 56 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,23 @@ jobs:
- name: Composer install
run: composer install --working-dir=tests/php

# Build mixture for cargo test.
- name: Docker compose
if: matrix.os == 'ubuntu-20.04'
run: docker compose up -d
- name: Setup docker (missing on MacOS)
if: matrix.os == 'macos-12'
run: |
brew install docker
brew install docker-compose
mkdir -p ~/.docker/cli-plugins
ln -sfn $(brew --prefix)/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose
colima start
# For test containers to find the Colima socket
# https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
# Build mixture for cargo test.
- name: Vagrant up for docker compose
if: matrix.os == 'macos-12'
run: vagrant up
- name: Docker compose
run: docker compose up -d --wait

# Try cargo test.
- name: Cargo test
Expand All @@ -198,14 +206,9 @@ jobs:

# Rebuild the mixture when cargo test failed.
- name: Docker compose restart
if: matrix.os == 'ubuntu-20.04' && steps.cargo-test-step.outcome != 'success'
if: steps.cargo-test-step.outcome != 'success'
run: docker compose restart

# Rebuild the mixture when cargo test failed.
- name: Vagrant reload for docker compose
if: matrix.os == 'macos-12' && steps.cargo-test-step.outcome != 'success'
run: vagrant reload

# Delay before retry.
- name: Delay
if: steps.cargo-test-step.outcome != 'success'
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ members = [

[package]
name = "skywalking-php"
version = "0.7.0"
version = "0.8.0-dev"
authors = ["Apache Software Foundation", "jmjoy <jmjoy@apache.org>", "Yanlong He <heyanlong@apache.org>"]
description = "Apache SkyWalking PHP Agent."
edition = "2021"
Expand Down
38 changes: 0 additions & 38 deletions Vagrantfile

This file was deleted.

10 changes: 8 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ services:
- "12800:12800"
healthcheck:
test: [ "CMD", "curl", "http://127.0.0.1:12800/healthCheck" ]
interval: 5s
interval: 10s
timeout: 5s
retries: 10

mysql:
image: mysql:5.7.39
Expand All @@ -45,12 +46,17 @@ services:
- "11211:11211"

rabbitmq:
image: rabbitmq:3.11.13
image: rabbitmq:3.12.8
ports:
- "5672:5672"
environment:
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
healthcheck:
test: [ "CMD", "rabbitmq-diagnostics", "check_running" ]
interval: 10s
timeout: 5s
retries: 10

mongo:
image: mongo:4.4.10
Expand Down
7 changes: 6 additions & 1 deletion src/plugin/plugin_swoole.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ impl SwooleServerPlugin {
validate_num_args(execute_data, 2)?;

let on = execute_data.get_parameter(0);
if !on.as_z_str().map(|s| s == b"request").unwrap_or_default() {
if !on
.as_z_str()
.and_then(|s| s.to_str().ok())
.map(|s| s.to_lowercase() == "request")
.unwrap_or_default()
{
return Ok(Box::new(()));
}

Expand Down

0 comments on commit 981dad9

Please sign in to comment.