Skip to content

Commit

Permalink
Add mutex to checkNodes()
Browse files Browse the repository at this point in the history
  • Loading branch information
nomeguy committed Oct 11, 2023
1 parent 4cec328 commit 63ea22d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 27 deletions.
8 changes: 7 additions & 1 deletion object/site_timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ package object

import (
"fmt"
"sync"
"time"
)

var siteUpdateMap = map[string]string{}
var (
siteUpdateMap = map[string]string{}
lock = &sync.Mutex{}
)

func monitorSites() error {
sites, err := GetGlobalSites()
Expand All @@ -33,7 +37,9 @@ func monitorSites() error {
// continue
//}

lock.Lock()
err = site.checkNodes()
lock.Unlock()
if err != nil {
return err
}
Expand Down
52 changes: 26 additions & 26 deletions web/src/SiteListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ class SiteListPage extends React.Component {
}

renderTable(sites) {
const renderExternalLink = () => {
return (
<svg style={{marginLeft: "5px"}} width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" className="iconExternalLink_nPIU">
<path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path>
</svg>
);
};
// const renderExternalLink = () => {
// return (
// <svg style={{marginLeft: "5px"}} width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" className="iconExternalLink_nPIU">
// <path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path>
// </svg>
// );
// };

const columns = [
{
Expand Down Expand Up @@ -309,25 +309,25 @@ class SiteListPage extends React.Component {
);
},
},
{
title: i18next.t("site:Casdoor app"),
dataIndex: "casdoorApplication",
key: "casdoorApplication",
width: "140px",
sorter: (a, b) => a.casdoorApplication.localeCompare(b.casdoorApplication),
render: (text, record, index) => {
if (text === "") {
return null;
}

return (
<a target="_blank" rel="noreferrer" href={Setting.getMyProfileUrl(this.state.account).replace("/account", `/applications/${this.props.account.owner}/${text}`)}>
{text}
{renderExternalLink()}
</a>
);
},
},
// {
// title: i18next.t("site:Casdoor app"),
// dataIndex: "casdoorApplication",
// key: "casdoorApplication",
// width: "140px",
// sorter: (a, b) => a.casdoorApplication.localeCompare(b.casdoorApplication),
// render: (text, record, index) => {
// if (text === "") {
// return null;
// }
//
// return (
// <a target="_blank" rel="noreferrer" href={Setting.getMyProfileUrl(this.state.account).replace("/account", `/applications/${this.props.account.owner}/${text}`)}>
// {text}
// {renderExternalLink()}
// </a>
// );
// },
// },
{
title: i18next.t("general:Action"),
dataIndex: "action",
Expand Down

0 comments on commit 63ea22d

Please sign in to comment.