You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "MJY-HUST (via GitHub)" <gi...@apache.org> on 2024/11/20 17:08:38 UTC

[PR] Change the default value of the bthread_tag in class ServerOptions to BTHREAD_TAG_DEFAULT (brpc)

MJY-HUST opened a new pull request, #2824:
URL: https://github.com/apache/brpc/pull/2824

   ### What problem does this PR solve?
   将ServerOptions 中的bthread_tag默认值改为BTHREAD_TAG_DEFAULT && 简化代码逻辑
   Issue Number:
   
   Problem Summary:
   
   ### What is changed and the side effects?
   
   Changed:
   
   Side effects:
   - Performance effects(性能影响):
   
   - Breaking backward compatibility(向后兼容性): 
   
   ---
   ### Check List:
   - Please make sure your changes are compilable(请确保你的更改可以通过编译).
   - When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
   - Please follow [Contributor Covenant Code of Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).(请遵循贡献者准则).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Change the default value of the bthread_tag in class ServerOptions to BTHREAD_TAG_DEFAULT (brpc)

Posted by "MJY-HUST (via GitHub)" <gi...@apache.org>.
MJY-HUST commented on code in PR #2824:
URL: https://github.com/apache/brpc/pull/2824#discussion_r1851219326


##########
src/bthread/bthread.cpp:
##########
@@ -400,18 +400,16 @@ int bthread_setconcurrency_by_tag(int num, bthread_tag_t tag) {
     auto tag_ngroup = c->concurrency(tag);
     auto add = num - tag_ngroup;
 
-    if (add > 0) {
+    if (add >= 0) {

Review Comment:
   等于0也会返回0吧



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Change the default value of the bthread_tag in class ServerOptions to BTHREAD_TAG_DEFAULT (brpc)

Posted by "yanglimingcn (via GitHub)" <gi...@apache.org>.
yanglimingcn commented on code in PR #2824:
URL: https://github.com/apache/brpc/pull/2824#discussion_r1851278146


##########
src/bthread/bthread.cpp:
##########
@@ -400,18 +400,16 @@ int bthread_setconcurrency_by_tag(int num, bthread_tag_t tag) {
     auto tag_ngroup = c->concurrency(tag);
     auto add = num - tag_ngroup;
 
-    if (add > 0) {
+    if (add >= 0) {

Review Comment:
   嗯,等于0,add_worker里面做了校验了,没啥问题。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Change the default value of the bthread_tag in class ServerOptions to BTHREAD_TAG_DEFAULT (brpc)

Posted by "zyearn (via GitHub)" <gi...@apache.org>.
zyearn merged PR #2824:
URL: https://github.com/apache/brpc/pull/2824


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Change the default value of the bthread_tag in class ServerOptions to BTHREAD_TAG_DEFAULT (brpc)

Posted by "yanglimingcn (via GitHub)" <gi...@apache.org>.
yanglimingcn commented on code in PR #2824:
URL: https://github.com/apache/brpc/pull/2824#discussion_r1851277939


##########
src/bthread/bthread.cpp:
##########
@@ -400,18 +400,16 @@ int bthread_setconcurrency_by_tag(int num, bthread_tag_t tag) {
     auto tag_ngroup = c->concurrency(tag);
     auto add = num - tag_ngroup;
 
-    if (add > 0) {
+    if (add >= 0) {
         auto added = c->add_workers(add, tag);
         bthread::FLAGS_bthread_concurrency += added;
         return (add == added ? 0 : EPERM);
 

Review Comment:
   这个空行可以删掉



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Change the default value of the bthread_tag in class ServerOptions to BTHREAD_TAG_DEFAULT (brpc)

Posted by "yanglimingcn (via GitHub)" <gi...@apache.org>.
yanglimingcn commented on PR #2824:
URL: https://github.com/apache/brpc/pull/2824#issuecomment-2492669784

   LGTM 👍


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Change the default value of the bthread_tag in class ServerOptions to BTHREAD_TAG_DEFAULT (brpc)

Posted by "yanglimingcn (via GitHub)" <gi...@apache.org>.
yanglimingcn commented on code in PR #2824:
URL: https://github.com/apache/brpc/pull/2824#discussion_r1851215640


##########
src/bthread/bthread.cpp:
##########
@@ -400,18 +400,16 @@ int bthread_setconcurrency_by_tag(int num, bthread_tag_t tag) {
     auto tag_ngroup = c->concurrency(tag);
     auto add = num - tag_ngroup;
 
-    if (add > 0) {
+    if (add >= 0) {

Review Comment:
   为啥等于0也走到这个逻辑,是为了返回0吗?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Change the default value of the bthread_tag in class ServerOptions to BTHREAD_TAG_DEFAULT (brpc)

Posted by "wwbmmm (via GitHub)" <gi...@apache.org>.
wwbmmm commented on PR #2824:
URL: https://github.com/apache/brpc/pull/2824#issuecomment-2490525604

   LGTM


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Change the default value of the bthread_tag in class ServerOptions to BTHREAD_TAG_DEFAULT (brpc)

Posted by "MJY-HUST (via GitHub)" <gi...@apache.org>.
MJY-HUST commented on code in PR #2824:
URL: https://github.com/apache/brpc/pull/2824#discussion_r1851983592


##########
src/bthread/bthread.cpp:
##########
@@ -400,18 +400,16 @@ int bthread_setconcurrency_by_tag(int num, bthread_tag_t tag) {
     auto tag_ngroup = c->concurrency(tag);
     auto add = num - tag_ngroup;
 
-    if (add > 0) {
+    if (add >= 0) {
         auto added = c->add_workers(add, tag);
         bthread::FLAGS_bthread_concurrency += added;
         return (add == added ? 0 : EPERM);
 

Review Comment:
   删了



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org