🐛 Fix status expired in cache
This commit is contained in:
parent
132d301aeb
commit
7c0713a12f
23
.idea/workspace.xml
generated
23
.idea/workspace.xml
generated
@ -4,15 +4,8 @@
|
|||||||
<option name="autoReloadType" value="ALL" />
|
<option name="autoReloadType" value="ALL" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: Can pick up mfa request">
|
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: Status system">
|
||||||
<change afterPath="$PROJECT_DIR$/pkg/internal/server/api/statuses_api.go" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/pkg/internal/services/statuses.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/statuses.go" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/pkg/internal/services/statuses.go" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/models/statuses.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/models/statuses.go" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/index.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/index.go" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/accounts.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/accounts.go" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/factors.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/factors.go" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/notifications.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/notifications.go" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -126,6 +119,14 @@
|
|||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
<option name="version" value="3" />
|
<option name="version" value="3" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="UnknownFeatures">
|
||||||
|
<option featureType="dependencySupport" implementationName="javascript:npm:prettier" />
|
||||||
|
<option featureType="dependencySupport" implementationName="executable:docker" />
|
||||||
|
<option featureType="dependencySupport" implementationName="javascript:npm:unocss" />
|
||||||
|
<option featureType="dependencySupport" implementationName="javascript:npm:vite" />
|
||||||
|
<option featureType="dependencySupport" implementationName="executable:kubectl" />
|
||||||
|
<option featureType="dependencySupport" implementationName="javascript:npm:vue" />
|
||||||
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
<option name="TAB_STATES">
|
<option name="TAB_STATES">
|
||||||
<map>
|
<map>
|
||||||
@ -150,7 +151,6 @@
|
|||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value=":sparkles: Able to read current user's realm profile" />
|
|
||||||
<MESSAGE value=":sparkles: Consul registration" />
|
<MESSAGE value=":sparkles: Consul registration" />
|
||||||
<MESSAGE value=":wastebasket: Remove HTTP provision to consul" />
|
<MESSAGE value=":wastebasket: Remove HTTP provision to consul" />
|
||||||
<MESSAGE value=":sparkles: Drop direct connection and uses consul" />
|
<MESSAGE value=":sparkles: Drop direct connection and uses consul" />
|
||||||
@ -175,7 +175,8 @@
|
|||||||
<MESSAGE value=":card_file_box: Add the status model" />
|
<MESSAGE value=":card_file_box: Add the status model" />
|
||||||
<MESSAGE value=":bug: Authenticate wrong payload hotfix" />
|
<MESSAGE value=":bug: Authenticate wrong payload hotfix" />
|
||||||
<MESSAGE value=":sparkles: Can pick up mfa request" />
|
<MESSAGE value=":sparkles: Can pick up mfa request" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Can pick up mfa request" />
|
<MESSAGE value=":sparkles: Status system" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Status system" />
|
||||||
</component>
|
</component>
|
||||||
<component name="VgoProject">
|
<component name="VgoProject">
|
||||||
<settings-migrated>true</settings-migrated>
|
<settings-migrated>true</settings-migrated>
|
||||||
|
@ -20,8 +20,12 @@ func NewStatus(user models.Account, status models.Status) (models.Status, error)
|
|||||||
|
|
||||||
func GetStatus(uid uint) (models.Status, error) {
|
func GetStatus(uid uint) (models.Status, error) {
|
||||||
if status, ok := statusCache[uid]; ok {
|
if status, ok := statusCache[uid]; ok {
|
||||||
|
if status.ClearAt != nil && status.ClearAt.Before(time.Now()) {
|
||||||
|
delete(statusCache, uid)
|
||||||
|
} else {
|
||||||
return status, nil
|
return status, nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
var status models.Status
|
var status models.Status
|
||||||
if err := database.C.
|
if err := database.C.
|
||||||
Where("account_id = ?", uid).
|
Where("account_id = ?", uid).
|
||||||
|
Loading…
Reference in New Issue
Block a user