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

feat: Support fix node #7549

Merged
merged 1 commit into from
Dec 24, 2024
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: 18 additions & 14 deletions core/app/service/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,20 +197,6 @@ func (u *SettingService) UpdatePort(port uint) error {
if err := firewall.UpdatePort(oldPort.Value, fmt.Sprintf("%v", port)); err != nil {
return err
}
masterAddr, err := settingRepo.Get(repo.WithByKey("MasterAddr"))
if err != nil {
global.LOG.Errorf("load master addr from db failed, err: %v", err)
return err
}
if len(masterAddr.Value) != 0 {
oldMasterPort := loadPort(masterAddr.Value)
if len(oldMasterPort) != 0 {
if err := xpack.UpdateMasterAddr(strings.ReplaceAll(masterAddr.Value, oldMasterPort, fmt.Sprintf("%v", port))); err != nil {
global.LOG.Errorf("update master addr from db failed, err: %v", err)
return err
}
}
}

if err := settingRepo.Update("ServerPort", strconv.Itoa(int(port))); err != nil {
return err
Expand All @@ -222,6 +208,23 @@ func (u *SettingService) UpdatePort(port uint) error {
global.LOG.Errorf("restart system port failed, err: %v", err)
}
}()

masterAddr, err := settingRepo.Get(repo.WithByKey("MasterAddr"))
if err != nil {
global.LOG.Errorf("load master addr from db failed, err: %v", err)
return
}
if len(masterAddr.Value) != 0 {
oldMasterPort := loadPort(masterAddr.Value)
if len(oldMasterPort) != 0 {
newMasterAddr := strings.ReplaceAll(masterAddr.Value, oldMasterPort, fmt.Sprintf("%v", port))
_ = settingRepo.Update("MasterAddr", newMasterAddr)
if err := xpack.UpdateMasterAddr(newMasterAddr); err != nil {
global.LOG.Errorf("update master addr from db failed, err: %v", err)
return
}
}
}
}()
return nil
}
Expand Down Expand Up @@ -306,6 +309,7 @@ func (u *SettingService) UpdateSSL(c *gin.Context, req dto.SSLUpdate) error {
} else {
addrItem = strings.ReplaceAll(addrItem, "http://", "https://")
}
_ = settingRepo.Update("MasterAddr", addrItem)
if err := xpack.UpdateMasterAddr(addrItem); err != nil {
global.LOG.Errorf("update master addr from db failed, err: %v", err)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There do not appear to be any specific irregularities, issues, optimizations, etc. noted in this code snippet that warrants detailed elaboration or comment. The function appears to contain several methods and checks within a larger context designed to modify settings for different services based on received inputs.

Some general comments:

  • masterAddr is imported but it does not seem directly used here or integrated into the method calls. It might not play a significant role if its use is restricted to other parts of the codebase.

Given there are no immediate observations suggesting issues with the syntax, style, efficiency, concurrency considerations, security vulnerabilities (like incorrect data input handling), memory management, I would say, overall, these changes do not warrant major revisions. If the functionality or flow could be improved at this stage considering current knowledge, then further discussion should happen between developers about how to best implement enhancements like error-handling improvements or more efficient algorithms, without altering base operationally necessary pieces.

If you provide an example where certain lines are problematic or inefficient, we can discuss the actual problems related to those areas and suggest solutions. Otherwise, as far as code quality concerns go, these few lines don't stand out.

Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const message = {
helpDoc: 'Help Document',
bind: 'Bind',
unbind: 'Unbind',
fix: 'Fix',
},
search: {
timeStart: 'Time start',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but based on the given snippet of TypeScript code in your question I can not provide you with precise information about the mentioned programming changes. The context is too abstract to identify specific differences between two different versions or even which version(s) you're talking about; however, one may assume there were no significant discrepancies due to being within the same timeframe (2021-09-01 till now). However, to ensure the accuracy and validity of such conclusions, you should have detailed analysis from multiple software developers rather than relying on mere observations like these.

Also remember that while checking for inconsistencies or errors, one might look into whether certain variables still hold their original values without being reassigned across the updated versions.

Lastly, consider this comment: "Optimization suggestions" would be better described elsewhere since it pertains more to performance improvements, tuning code, enhancing efficiency, or other aspects unrelated specifically to the difference detection issue at hand.

Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/tw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const message = {
helpDoc: '幫助文档',
bind: '綁定',
unbind: '解除綁定',
fix: '修復',
},
search: {
timeStart: '開始時間',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The given code snippet is already well-formatted and does not contain any inconsistencies, potential issues, or optimizations that could be suggested for improvement. It appears to follow good practices such as variable naming conventions (CamelCase), consistent use of semicolons, and indentation for readability. There is no specific issue or suggestion that can be derived from this comparison without additional input on the nature of the questions being asked.

Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const message = {
helpDoc: '帮助文档',
bind: '绑定',
unbind: '解绑',
fix: '修复',
},
search: {
timeStart: '开始时间',
Expand Down
Loading