Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用中的一些问题,劳烦指导一下 #36

Open
DevelopmentMan opened this issue Aug 23, 2024 · 6 comments
Open

使用中的一些问题,劳烦指导一下 #36

DevelopmentMan opened this issue Aug 23, 2024 · 6 comments

Comments

@DevelopmentMan
Copy link

1、在执行Http任务时,是否可以将http请求返回的数据记录下来?比如接口返回的json结构数据。
2、在自定义corn执行时,日志中有重复记录,不知道是什么原因,如下图
image
image

@DevelopmentMan
Copy link
Author

image
有个疑问,这个http接口应该是404的,但是是否成功为:是。这个是否成功只是代表执行了没有吗?不代表请求成功没有。

@2881099
Copy link
Owner

2881099 commented Aug 23, 2024

if (http.Response.ContentType.Contains("text/json")) 
    task.Remark(http.Response.StatusCode.ToString() + " " + http.Response.Xml);
else 
    task.Remark(http.Response.StatusCode.ToString());

是否成功/异常信息的维度是任务

HTTP的反馈看备注

@2881099
Copy link
Owner

2881099 commented Aug 23, 2024

重复记录的原因,是不是 cron 错误解析失败,没正确计算出间隔

@DevelopmentMan
Copy link
Author

DevelopmentMan commented Aug 23, 2024

第一个问题,我粗略看了下源码是否可以这么改呢
image
结果是我想要的,但是没看完全看源码,不知道是否会有问题,或者有其他方案
image

@DevelopmentMan
Copy link
Author

第二个问题是这么写的,结果也正确了
image

@2881099
Copy link
Owner

2881099 commented Aug 23, 2024

if (http.Response.ContentType.Contains("json"))
task.Remark(http.Response.StatusCode.ToString() + " " + http.Response.Xml);
else
task.Remark(http.Response.StatusCode.ToString());

这样是不可行,ContentType.Contains 只改这里

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants