-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add end of trial notification #319
Conversation
src/main/kotlin/com/sourcegraph/cody/api/SourcegraphApiRequests.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/sourcegraph/common/EndOfTrialNotification.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/sourcegraph/common/EndOfTrialNotification.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/sourcegraph/common/EndOfTrialNotification.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/sourcegraph/common/EndOfTrialNotification.kt
Outdated
Show resolved
Hide resolved
f65f8d6
to
6c5f52c
Compare
6c5f52c
to
0e620b4
Compare
74d1875
to
2da2322
Compare
8a3759a
to
e5b7e2f
Compare
2dbb7d0
to
dbf5e8d
Compare
thanks @mkondratek! in both notifications can you add a bit of bottom padding to space out the title and the body of the notification? in the first notification, are you able to add a line break after |
That would not be idiomatic - our notification will look very strange compared to the other notifications. I suggest keeping the present padding. |
src/main/kotlin/com/sourcegraph/cody/agent/protocol/CurrentUserCodySubscription.kt
Show resolved
Hide resolved
CodyAgentService.applyAgentOnBackgroundThread(project) { agent -> | ||
agent.server | ||
.getCurrentUserCodySubscription() | ||
.thenApply { currentUserCodySubscription -> |
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.
DO NOT run thenApply
on server responses.
Or, run it if you want, but first answer me this:
on which thread/threadpool this will be running, and how big that thread pool is? :)
I do not consider it to be safe, maybe we should so some automagical wrapping just to be able to use it without thinking about it.
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.
I do completeOnTimeout
in the same block in line 63. I think it will be running on the very same thread (started by applyAgentOnBackgroundThread
in line 39).
I do not understand your concerns in this case but likely I miss something. Let's discuss it via f2f.
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.
How it can be running in the same thread, if the current thread can even finish in the meantime? :) This is not a blocking operation. It's tricky, I agree, let's discuss on the standup tomorrow.
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.
I refactored the code so it's easier to read and understand.
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.
Agree, it's much more readable now, thank you!
|
||
agent.server | ||
.evaluateFeatureFlag(GetFeatureFlag.CodyProTrialEnded) | ||
.completeOnTimeout(false, 4, TimeUnit.SECONDS) |
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.
Just to be safe, cannot we wait longer if that is a method run once every 2h?
Or is it simply always expected to return in xx ms?
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.
we can but 4 seconds seems to be much more than needed for a feature flag check + it is consistent with other timeouts
src/main/kotlin/com/sourcegraph/cody/initialization/EndOfTrialNotificationScheduler.kt
Show resolved
Hide resolved
codyProTrialEnded: Boolean, | ||
useSscForCodySubscription: Boolean | ||
) { | ||
if (currentUserCodySubscription.plan == Plan.PRO && |
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.
I verified logic with the specification and to my eyes it look good.
…ip agent call on enterprise account; improve logging
30f6620
to
f20090b
Compare
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.
LGTM
Fixes #244 and #245.
Test plan