- Notifications
You must be signed in to change notification settings - Fork928
feat: add "dormant" user state#8644
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
require.Eventually(t, func() bool { | ||
rows, err = db.GetUsers(ctx, database.GetUsersParams{}) | ||
if err != nil { | ||
return false | ||
} | ||
var c int | ||
for _, row := range rows { | ||
if row.Status == database.UserStatusDormant { | ||
c++ | ||
} | ||
} | ||
// 6 users in total, 3 dormant | ||
return len(rows) == 6 && c == 3 | ||
}, testutil.WaitShort, testutil.IntervalMedium) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Suggestion: if you allow passing in atick chan time.Time
andupdated chan int
intoCheckInactiveUsersWithOptions
you can then conceivably remove thisrequire.Eventually
- you write a time totick
, and read the number of updated users fromupdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is a good hint in case we want to do something more with these accounts than validate in unit tests. I would keep it simple as is.
SET | ||
user_status = 'dormant'::user_status | ||
WHERE | ||
last_seen_at < @last_seen_after :: timestamp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
note for readers: this is correct aslast_seen_at
istimestamp without time zone
.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Related:#8128
This PR officially introduces another user account status -
dormant
. Users who have not logged in yet to the Coder platform will be marked as dormant, and will not be included in the license seat calculations.Low-level changes:
dormant
user statusExtractAPIKeyMW
to switch a "dormant" account to "active"Testing:
@coder.com
Google accountNotes:
Next steps: