You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2023/06/28 11:01:09 UTC
[skywalking-php] branch master updated: Fix the situation where the redis port is string. (#80)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-php.git
The following commit(s) were added to refs/heads/master by this push:
new 239eff9 Fix the situation where the redis port is string. (#80)
239eff9 is described below
commit 239eff956595ac7a5b77ca271339000c4e3f038d
Author: jmjoy <jm...@apache.org>
AuthorDate: Wed Jun 28 19:01:04 2023 +0800
Fix the situation where the redis port is string. (#80)
---
src/plugin/plugin_redis.rs | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/plugin/plugin_redis.rs b/src/plugin/plugin_redis.rs
index e5500d1..42ca30c 100644
--- a/src/plugin/plugin_redis.rs
+++ b/src/plugin/plugin_redis.rs
@@ -238,18 +238,15 @@ impl RedisPlugin {
}
};
let port = {
- let f = || {
- execute_data
- .get_parameter(1)
- .as_long()
- .context("isn't long")
- };
- match f() {
- Ok(port) => port,
- Err(err) => {
- warn!(?err, "parse second argument to port failed, skipped.");
- return Ok(Box::new(()));
- }
+ let port = execute_data.get_parameter(1);
+
+ if let Some(port) = port.as_long() {
+ port.to_string()
+ } else if let Some(port) = port.as_z_str() {
+ port.to_str().unwrap_or("0").to_string()
+ } else {
+ warn!("parse second argument to port failed, skipped.");
+ return Ok(Box::new(()));
}
};