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

[GH-613]:Fixed issue "API rate limit exceeded for user ID". #626

Merged
merged 20 commits into from
Jul 19, 2023

Conversation

Kshitij-Katiyar
Copy link
Contributor

@Kshitij-Katiyar Kshitij-Katiyar commented Dec 30, 2022

Summary

* [MI-2481]:Fixed issue mattermost#681 on github

* [MI-2481]:Fixed review fixes

* [MI-2481]:Fixed review fixes

* [MI-2481]:Fixed review fixes
@mattermod
Copy link
Contributor

Hello @Kshitij-Katiyar,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@codecov-commenter
Copy link

codecov-commenter commented Dec 30, 2022

Codecov Report

Patch coverage: 1.29% and project coverage change: -0.13 ⚠️

Comparison is base (dcf1828) 15.63% compared to head (772c8c3) 15.51%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #626      +/-   ##
==========================================
- Coverage   15.63%   15.51%   -0.13%     
==========================================
  Files          15       15              
  Lines        5518     5543      +25     
==========================================
- Hits          863      860       -3     
- Misses       4613     4641      +28     
  Partials       42       42              
Impacted Files Coverage Δ
server/plugin/plugin.go 5.54% <0.00%> (-0.38%) ⬇️
server/plugin/api.go 7.52% <3.44%> (-0.12%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@hanzei hanzei requested review from mickmister and removed request for hanzei January 2, 2023 22:11
@hanzei hanzei linked an issue Jan 2, 2023 that may be closed by this pull request
@hanzei hanzei added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Jan 2, 2023
Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Great work on this @Kshitij-Katiyar 👍 I have just a few requests

webapp/src/client/client.js Outdated Show resolved Hide resolved
webapp/src/components/sidebar_right/sidebar_right.jsx Outdated Show resolved Hide resolved
webapp/src/websocket/index.js Outdated Show resolved Hide resolved
webapp/src/components/sidebar_buttons/sidebar_buttons.jsx Outdated Show resolved Hide resolved
webapp/src/reducers/index.js Outdated Show resolved Hide resolved
webapp/src/action_types/index.js Outdated Show resolved Hide resolved
webapp/src/components/sidebar_right/index.jsx Outdated Show resolved Hide resolved
server/plugin/plugin.go Outdated Show resolved Hide resolved
server/plugin/plugin.go Outdated Show resolved Hide resolved
server/plugin/api.go Outdated Show resolved Hide resolved
* [MI-2547]:Fixed review fixes for Github issue 613 and PR 626

* [MI-2547]:Fixed review fixes

* [MI-2547]:Fixed review fixes
Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Just one remaining request to avoid returning nil, and a few suggestions. Otherwise LGTM 👍

server/plugin/api.go Outdated Show resolved Hide resolved
webapp/src/components/sidebar_buttons/sidebar_buttons.jsx Outdated Show resolved Hide resolved
webapp/src/reducers/index.js Outdated Show resolved Hide resolved
webapp/src/selectors.js Show resolved Hide resolved
Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @Kshitij-Katiyar

@spirosoik
Copy link
Member

/update-branch

@mattermost-build
Copy link
Contributor

We don't have permissions to update this PR, please contact the submitter to apply the update.

@mattermost-build
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

Copy link
Contributor

@hanzei hanzei left a comment

Choose a reason for hiding this comment

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

Really nice work 💯

A few non-blocking comments below

server/plugin/api.go Outdated Show resolved Hide resolved
server/plugin/api.go Outdated Show resolved Hide resolved
server/plugin/plugin.go Outdated Show resolved Hide resolved
@hanzei hanzei removed the 2: Dev Review Requires review by a core committer label Feb 3, 2023
@DHaussermann
Copy link

DHaussermann commented Jun 29, 2023

@Kshitij-Katiyar I have this deployed to take another look...
I can keep watching for the API error. But something odd is happening. The counts are incorrectly coming back as 0 for all 4 values.
image

I have the last commit deployed.
image

I followed my steps from earlier this year. #626 (comment)

Can you please see if you can reproduce this?

@DHaussermann
Copy link

@Kshitij-Katiyar 0/5 This might only repo with account data I have.

{"timestamp":"2023-06-29 19:29:30.509 Z","level":"debug","msg":"Received HTTP request","caller":"web/handlers.go:156","method":"GET","url":"/api/v4/teams/k8wxoi184bb6bd4jq9f44f688h/commands/autocomplete_suggestions","request_id":"6344za5ok3bcijkd9yrn77oi4r","status_code":"200"}
{"timestamp":"2023-06-29 19:29:34.954 Z","level":"debug","msg":"Received HTTP request","caller":"web/handlers.go:156","method":"GET","url":"/api/v4/system/ping","request_id":"oiefr9ar4f8mzrsjxn6is9j4dh","status_code":"200"}
{"timestamp":"2023-06-29 19:29:35.281 Z","level":"warn","msg":"Recovered from a panic","caller":"app/plugin_api.go:943","plugin_id":"github","url":"/api/v1/lhs-content","error":"runtime error: invalid memory address or nil pointer dereference","stack":"goroutine 157 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).withRecovery.func1.1()\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:174 +0x75\npanic({0xf1a7c0, 0x1946710})\n\truntime/panic.go:884 +0x212\ngithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql.getPROrIssue(0x0, 0xc0008e2e90)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql/lhs_request.go:97 +0x38\ngithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql.(*Client).GetLHSData(0xc0004caf80, {0x126cc08, 0xc0008a8a80})\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql/lhs_request.go:67 +0xee5\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).getLHSData(0x18?, 0xc0004caf40)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:944 +0x3a\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).getSidebarData(0xc000946180?, 0x7ad2a70680f8?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:953 +0x3b\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).getSidebarContent(0xc0001272c8?, 0xc0004caf40, {0x126bcc8, 0xc0008c52e0}, 0xffffffffffffff01?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:967 +0x31\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).attachUserContext.func1({0x126bcc8, 0xc0008c52e0}, 0xc000127380?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:261 +0x1d3\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).checkAuth.func1({0x126bcc8, 0xc0008c52e0}, 0xc0007aa000)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:210 +0x19e\nnet/http.HandlerFunc.ServeHTTP(0x7ad2ce52f5b8?, {0x126bcc8?, 0xc0008c52e0?}, 0x0?)\n\tnet/http/server.go:2109 +0x2f\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).checkConfigured.func1({0x126bcc8, 0xc0008c52e0}, 0xc00063b520?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:191 +0x98\nnet/http.HandlerFunc.ServeHTTP(0xf8?, {0x126bcc8?, 0xc0008c52e0?}, 0xc0001274c8?)\n\tnet/http/server.go:2109 +0x2f\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).withRecovery.func1({0x126bcc8?, 0xc0008c52e0?}, 0xc0008bdb90?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:178 +0x85\nnet/http.HandlerFunc.ServeHTTP(0xc00064bf00?, {0x126bcc8?, 0xc0008c52e0?}, 0xc000247000?)\n\tnet/http/server.go:2109 +0x2f\ngithub.com/gorilla/mux.(*Router).ServeHTTP(0xc0000d6240, {0x126bcc8, 0xc0008c52e0}, 0xc00064b800)\n\tgithub.com/gorilla/mux@v1.8.0/mux.go:210 +0x1cf\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).ServeHTTP(0xc00063b520, 0x1070920?, {0x126bcc8, 0xc0008c52e0}, 0x3?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:281 +0xe5\ngithub.com/mattermost/mattermost-server/v6/plugin.(*hooksRPCServer).ServeHTTP(0xc000083c20, 0xc000083100, 0x1?)\n\tgithub.com/mattermost/mattermost-server/v6@v6.0.0-20221109191448-21aec2741bfe/plugin/client_rpc.go:453 +0x417\nreflect.Value.call({0xc000653c20?, 0xc000012d98?, 0x50002?}, {0x107aaa9, 0x4}, {0xc0002f0ef8, 0x3, 0xc0002f0e58?})\n\treflect/value.go:584 +0x8c5\nreflect.Value.Call({0xc000653c20?, 0xc000012d98?, 0x46e757?}, {0xc0002f0ef8?, 0x487817?, 0xc0002f0f10?})\n\treflect/value.go:368 +0xbc\nnet/rpc.(*service).call(0xc00067a500, 0x6a700e?, 0xc0008cd800?, 0xc00030aec0, 0xc0003f5a00, 0xc0008cd800?, {0xe7df20?, 0xc000083100?, 0x8de226?}, {0xe8b1e0, ...}, ...)\n\tnet/rpc/server.go:382 +0x226\ncreated by net/rpc.(*Server).ServeCodec\n\tnet/rpc/server.go:479 +0x3fe\n"}
{"timestamp":"2023-06-29 19:29:38.627 Z","level":"warn","msg":"Recovered from a panic","caller":"app/plugin_api.go:943","plugin_id":"github","url":"/api/v1/lhs-content","error":"runtime error: invalid memory address or nil pointer dereference","stack":"goroutine 161 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).withRecovery.func1.1()\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:174 +0x75\npanic({0xf1a7c0, 0x1946710})\n\truntime/panic.go:884 +0x212\ngithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql.getPROrIssue(0x0, 0xc000a82e90)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql/lhs_request.go:97 +0x38\ngithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql.(*Client).GetLHSData(0xc0004cb640, {0x126cc08, 0xc000afbe60})\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql/lhs_request.go:67 +0xee5\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).getLHSData(0x18?, 0xc0004cb580)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:944 +0x3a\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).getSidebarData(0xc000689950?, 0x7ad2a70680f8?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:953 +0x3b\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).getSidebarContent(0xc0007352c8?, 0xc0004cb580, {0x126bcc8, 0xc000a16050}, 0xffffffffffffff01?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:967 +0x31\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).attachUserContext.func1({0x126bcc8, 0xc000a16050}, 0xc000735380?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:261 +0x1d3\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).checkAuth.func1({0x126bcc8, 0xc000a16050}, 0xc000183500)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:210 +0x19e\nnet/http.HandlerFunc.ServeHTTP(0x30?, {0x126bcc8?, 0xc000a16050?}, 0x0?)\n\tnet/http/server.go:2109 +0x2f\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).checkConfigured.func1({0x126bcc8, 0xc000a16050}, 0xc00063b520?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:191 +0x98\nnet/http.HandlerFunc.ServeHTTP(0xf8?, {0x126bcc8?, 0xc000a16050?}, 0xc0007354c8?)\n\tnet/http/server.go:2109 +0x2f\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).withRecovery.func1({0x126bcc8?, 0xc000a16050?}, 0xc000689830?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:178 +0x85\nnet/http.HandlerFunc.ServeHTTP(0xc000183400?, {0x126bcc8?, 0xc000a16050?}, 0xc000066400?)\n\tnet/http/server.go:2109 +0x2f\ngithub.com/gorilla/mux.(*Router).ServeHTTP(0xc0000d6240, {0x126bcc8, 0xc000a16050}, 0xc000182d00)\n\tgithub.com/gorilla/mux@v1.8.0/mux.go:210 +0x1cf\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).ServeHTTP(0xc00063b520, 0x1070920?, {0x126bcc8, 0xc000a16050}, 0x3?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:281 +0xe5\ngithub.com/mattermost/mattermost-server/v6/plugin.(*hooksRPCServer).ServeHTTP(0xc000083c20, 0xc0004a4b60, 0x1?)\n\tgithub.com/mattermost/mattermost-server/v6@v6.0.0-20221109191448-21aec2741bfe/plugin/client_rpc.go:453 +0x417\nreflect.Value.call({0xc000653c20?, 0xc000012d98?, 0x200010005?}, {0x107aaa9, 0x4}, {0xc000805ef8, 0x3, 0xc000805e58?})\n\treflect/value.go:584 +0x8c5\nreflect.Value.Call({0xc000653c20?, 0xc000012d98?, 0x46e757?}, {0xc000805ef8?, 0x487817?, 0xc000805f10?})\n\treflect/value.go:368 +0xbc\nnet/rpc.(*service).call(0xc00067a500, 0x6a700e?, 0xc000952180?, 0xc00030aec0, 0xc0003f5a00, 0xc000952180?, {0xe7df20?, 0xc0004a4b60?, 0xc000184240?}, {0xe8b1e0, ...}, ...)\n\tnet/rpc/server.go:382 +0x226\ncreated by net/rpc.(*Server).ServeCodec\n\tnet/rpc/server.go:479 +0x3fe\n"}
{"timestamp":"2023-06-29 19:29:38.714 Z","level":"debug","msg":"Checking feature flags from management service","caller":"app/feature_flags.go:45","old_flags":"{\"TestFeature\":\"on\",\"TestBoolFeature\":true,\"CollapsedThreads\":true,\"EnableRemoteClusterService\":false,\"AppsEnabled\":true,\"PluginPlaybooks\":\"\",\"PluginApps\":\"off\",\"PluginFocalboard\":\"off\",\"PluginCalls\":\"off\",\"PermalinkPreviews\":true,\"CallsMobile\":false,\"CallsEnabled\":true,\"BoardsFeatureFlags\":\"on\",\"GuidedChannelCreation\":false,\"InviteToTeam\":\"none\",\"CustomGroups\":true,\"BoardsDataRetention\":false,\"NormalizeLdapDNs\":false,\"EnableInactivityCheckJob\":false,\"UseCaseOnboarding\":true,\"GraphQL\":false,\"InsightsEnabled\":true,\"CommandPalette\":false,\"AdvancedTextEditor\":true}","new_flags":"{\"TestFeature\":\"on\",\"TestBoolFeature\":true,\"CollapsedThreads\":true,\"EnableRemoteClusterService\":false,\"AppsEnabled\":true,\"PluginPlaybooks\":\"\",\"PluginApps\":\"off\",\"PluginFocalboard\":\"off\",\"PluginCalls\":\"off\",\"PermalinkPreviews\":true,\"CallsMobile\":false,\"CallsEnabled\":true,\"BoardsFeatureFlags\":\"on\",\"GuidedChannelCreation\":false,\"InviteToTeam\":\"none\",\"CustomGroups\":true,\"BoardsDataRetention\":false,\"NormalizeLdapDNs\":false,\"EnableInactivityCheckJob\":false,\"UseCaseOnboarding\":true,\"GraphQL\":false,\"InsightsEnabled\":true,\"CommandPalette\":false,\"AdvancedTextEditor\":true}"}
{"timestamp":"2023-06-29 19:29:38.725 Z","level":"info","msg":"This node attempted to join the cluster, but could not find any nodes.","caller":"cluster/cluster.go:391"}
{"timestamp":"2023-06-29 19:29:39.954 Z","level":"debug","msg":"Received HTTP request","caller":"web/handlers.go:156","method":"GET","url":"/api/v4/system/ping","request_id":"4uqwkauqwbnpmgmc3tqmsqxbcc","status_code":"200"}
{"timestamp":"2023-06-29 19:29:39.954 Z","level":"debug","msg":"Received HTTP request","caller":"web/handlers.go:156","method":"GET","url":"/api/v4/system/ping","request_id":"o61p1ono7jgf5x47xtczckmxyr","status_code":"200"}

Please advise.

@Kshitij-Katiyar
Copy link
Contributor Author

@Kshitij-Katiyar 0/5 This might only repo with account data I have.

{"timestamp":"2023-06-29 19:29:30.509 Z","level":"debug","msg":"Received HTTP request","caller":"web/handlers.go:156","method":"GET","url":"/api/v4/teams/k8wxoi184bb6bd4jq9f44f688h/commands/autocomplete_suggestions","request_id":"6344za5ok3bcijkd9yrn77oi4r","status_code":"200"}
{"timestamp":"2023-06-29 19:29:34.954 Z","level":"debug","msg":"Received HTTP request","caller":"web/handlers.go:156","method":"GET","url":"/api/v4/system/ping","request_id":"oiefr9ar4f8mzrsjxn6is9j4dh","status_code":"200"}
{"timestamp":"2023-06-29 19:29:35.281 Z","level":"warn","msg":"Recovered from a panic","caller":"app/plugin_api.go:943","plugin_id":"github","url":"/api/v1/lhs-content","error":"runtime error: invalid memory address or nil pointer dereference","stack":"goroutine 157 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).withRecovery.func1.1()\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:174 +0x75\npanic({0xf1a7c0, 0x1946710})\n\truntime/panic.go:884 +0x212\ngithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql.getPROrIssue(0x0, 0xc0008e2e90)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql/lhs_request.go:97 +0x38\ngithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql.(*Client).GetLHSData(0xc0004caf80, {0x126cc08, 0xc0008a8a80})\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql/lhs_request.go:67 +0xee5\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).getLHSData(0x18?, 0xc0004caf40)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:944 +0x3a\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).getSidebarData(0xc000946180?, 0x7ad2a70680f8?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:953 +0x3b\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).getSidebarContent(0xc0001272c8?, 0xc0004caf40, {0x126bcc8, 0xc0008c52e0}, 0xffffffffffffff01?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:967 +0x31\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).attachUserContext.func1({0x126bcc8, 0xc0008c52e0}, 0xc000127380?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:261 +0x1d3\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).checkAuth.func1({0x126bcc8, 0xc0008c52e0}, 0xc0007aa000)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:210 +0x19e\nnet/http.HandlerFunc.ServeHTTP(0x7ad2ce52f5b8?, {0x126bcc8?, 0xc0008c52e0?}, 0x0?)\n\tnet/http/server.go:2109 +0x2f\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).checkConfigured.func1({0x126bcc8, 0xc0008c52e0}, 0xc00063b520?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:191 +0x98\nnet/http.HandlerFunc.ServeHTTP(0xf8?, {0x126bcc8?, 0xc0008c52e0?}, 0xc0001274c8?)\n\tnet/http/server.go:2109 +0x2f\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).withRecovery.func1({0x126bcc8?, 0xc0008c52e0?}, 0xc0008bdb90?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:178 +0x85\nnet/http.HandlerFunc.ServeHTTP(0xc00064bf00?, {0x126bcc8?, 0xc0008c52e0?}, 0xc000247000?)\n\tnet/http/server.go:2109 +0x2f\ngithub.com/gorilla/mux.(*Router).ServeHTTP(0xc0000d6240, {0x126bcc8, 0xc0008c52e0}, 0xc00064b800)\n\tgithub.com/gorilla/mux@v1.8.0/mux.go:210 +0x1cf\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).ServeHTTP(0xc00063b520, 0x1070920?, {0x126bcc8, 0xc0008c52e0}, 0x3?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:281 +0xe5\ngithub.com/mattermost/mattermost-server/v6/plugin.(*hooksRPCServer).ServeHTTP(0xc000083c20, 0xc000083100, 0x1?)\n\tgithub.com/mattermost/mattermost-server/v6@v6.0.0-20221109191448-21aec2741bfe/plugin/client_rpc.go:453 +0x417\nreflect.Value.call({0xc000653c20?, 0xc000012d98?, 0x50002?}, {0x107aaa9, 0x4}, {0xc0002f0ef8, 0x3, 0xc0002f0e58?})\n\treflect/value.go:584 +0x8c5\nreflect.Value.Call({0xc000653c20?, 0xc000012d98?, 0x46e757?}, {0xc0002f0ef8?, 0x487817?, 0xc0002f0f10?})\n\treflect/value.go:368 +0xbc\nnet/rpc.(*service).call(0xc00067a500, 0x6a700e?, 0xc0008cd800?, 0xc00030aec0, 0xc0003f5a00, 0xc0008cd800?, {0xe7df20?, 0xc000083100?, 0x8de226?}, {0xe8b1e0, ...}, ...)\n\tnet/rpc/server.go:382 +0x226\ncreated by net/rpc.(*Server).ServeCodec\n\tnet/rpc/server.go:479 +0x3fe\n"}
{"timestamp":"2023-06-29 19:29:38.627 Z","level":"warn","msg":"Recovered from a panic","caller":"app/plugin_api.go:943","plugin_id":"github","url":"/api/v1/lhs-content","error":"runtime error: invalid memory address or nil pointer dereference","stack":"goroutine 161 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).withRecovery.func1.1()\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:174 +0x75\npanic({0xf1a7c0, 0x1946710})\n\truntime/panic.go:884 +0x212\ngithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql.getPROrIssue(0x0, 0xc000a82e90)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql/lhs_request.go:97 +0x38\ngithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql.(*Client).GetLHSData(0xc0004cb640, {0x126cc08, 0xc000afbe60})\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/graphql/lhs_request.go:67 +0xee5\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).getLHSData(0x18?, 0xc0004cb580)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:944 +0x3a\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).getSidebarData(0xc000689950?, 0x7ad2a70680f8?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:953 +0x3b\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).getSidebarContent(0xc0007352c8?, 0xc0004cb580, {0x126bcc8, 0xc000a16050}, 0xffffffffffffff01?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:967 +0x31\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).attachUserContext.func1({0x126bcc8, 0xc000a16050}, 0xc000735380?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:261 +0x1d3\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).checkAuth.func1({0x126bcc8, 0xc000a16050}, 0xc000183500)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:210 +0x19e\nnet/http.HandlerFunc.ServeHTTP(0x30?, {0x126bcc8?, 0xc000a16050?}, 0x0?)\n\tnet/http/server.go:2109 +0x2f\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).checkConfigured.func1({0x126bcc8, 0xc000a16050}, 0xc00063b520?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:191 +0x98\nnet/http.HandlerFunc.ServeHTTP(0xf8?, {0x126bcc8?, 0xc000a16050?}, 0xc0007354c8?)\n\tnet/http/server.go:2109 +0x2f\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).withRecovery.func1({0x126bcc8?, 0xc000a16050?}, 0xc000689830?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:178 +0x85\nnet/http.HandlerFunc.ServeHTTP(0xc000183400?, {0x126bcc8?, 0xc000a16050?}, 0xc000066400?)\n\tnet/http/server.go:2109 +0x2f\ngithub.com/gorilla/mux.(*Router).ServeHTTP(0xc0000d6240, {0x126bcc8, 0xc000a16050}, 0xc000182d00)\n\tgithub.com/gorilla/mux@v1.8.0/mux.go:210 +0x1cf\ngithub.com/mattermost/mattermost-plugin-github/server/plugin.(*Plugin).ServeHTTP(0xc00063b520, 0x1070920?, {0x126bcc8, 0xc000a16050}, 0x3?)\n\tgithub.com/mattermost/mattermost-plugin-github/server/plugin/api.go:281 +0xe5\ngithub.com/mattermost/mattermost-server/v6/plugin.(*hooksRPCServer).ServeHTTP(0xc000083c20, 0xc0004a4b60, 0x1?)\n\tgithub.com/mattermost/mattermost-server/v6@v6.0.0-20221109191448-21aec2741bfe/plugin/client_rpc.go:453 +0x417\nreflect.Value.call({0xc000653c20?, 0xc000012d98?, 0x200010005?}, {0x107aaa9, 0x4}, {0xc000805ef8, 0x3, 0xc000805e58?})\n\treflect/value.go:584 +0x8c5\nreflect.Value.Call({0xc000653c20?, 0xc000012d98?, 0x46e757?}, {0xc000805ef8?, 0x487817?, 0xc000805f10?})\n\treflect/value.go:368 +0xbc\nnet/rpc.(*service).call(0xc00067a500, 0x6a700e?, 0xc000952180?, 0xc00030aec0, 0xc0003f5a00, 0xc000952180?, {0xe7df20?, 0xc0004a4b60?, 0xc000184240?}, {0xe8b1e0, ...}, ...)\n\tnet/rpc/server.go:382 +0x226\ncreated by net/rpc.(*Server).ServeCodec\n\tnet/rpc/server.go:479 +0x3fe\n"}
{"timestamp":"2023-06-29 19:29:38.714 Z","level":"debug","msg":"Checking feature flags from management service","caller":"app/feature_flags.go:45","old_flags":"{\"TestFeature\":\"on\",\"TestBoolFeature\":true,\"CollapsedThreads\":true,\"EnableRemoteClusterService\":false,\"AppsEnabled\":true,\"PluginPlaybooks\":\"\",\"PluginApps\":\"off\",\"PluginFocalboard\":\"off\",\"PluginCalls\":\"off\",\"PermalinkPreviews\":true,\"CallsMobile\":false,\"CallsEnabled\":true,\"BoardsFeatureFlags\":\"on\",\"GuidedChannelCreation\":false,\"InviteToTeam\":\"none\",\"CustomGroups\":true,\"BoardsDataRetention\":false,\"NormalizeLdapDNs\":false,\"EnableInactivityCheckJob\":false,\"UseCaseOnboarding\":true,\"GraphQL\":false,\"InsightsEnabled\":true,\"CommandPalette\":false,\"AdvancedTextEditor\":true}","new_flags":"{\"TestFeature\":\"on\",\"TestBoolFeature\":true,\"CollapsedThreads\":true,\"EnableRemoteClusterService\":false,\"AppsEnabled\":true,\"PluginPlaybooks\":\"\",\"PluginApps\":\"off\",\"PluginFocalboard\":\"off\",\"PluginCalls\":\"off\",\"PermalinkPreviews\":true,\"CallsMobile\":false,\"CallsEnabled\":true,\"BoardsFeatureFlags\":\"on\",\"GuidedChannelCreation\":false,\"InviteToTeam\":\"none\",\"CustomGroups\":true,\"BoardsDataRetention\":false,\"NormalizeLdapDNs\":false,\"EnableInactivityCheckJob\":false,\"UseCaseOnboarding\":true,\"GraphQL\":false,\"InsightsEnabled\":true,\"CommandPalette\":false,\"AdvancedTextEditor\":true}"}
{"timestamp":"2023-06-29 19:29:38.725 Z","level":"info","msg":"This node attempted to join the cluster, but could not find any nodes.","caller":"cluster/cluster.go:391"}
{"timestamp":"2023-06-29 19:29:39.954 Z","level":"debug","msg":"Received HTTP request","caller":"web/handlers.go:156","method":"GET","url":"/api/v4/system/ping","request_id":"4uqwkauqwbnpmgmc3tqmsqxbcc","status_code":"200"}
{"timestamp":"2023-06-29 19:29:39.954 Z","level":"debug","msg":"Received HTTP request","caller":"web/handlers.go:156","method":"GET","url":"/api/v4/system/ping","request_id":"o61p1ono7jgf5x47xtczckmxyr","status_code":"200"}

Please advise.

@DHaussermann I have fixed the above issue. Just needed a minor change. Please test this again

Copy link

@DHaussermann DHaussermann left a comment

Choose a reason for hiding this comment

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

Tested and passed.
This now passes functional testing.

  • Ensured web app will periodically fetch updated counts when they have changed
  • Refresh option works to get new counts right away
  • Panic form comment above ☝️ is resolved
  • No sign of rate limit issue is server logs anymore

LGTM!

@DHaussermann
Copy link

DHaussermann commented Jul 5, 2023

@hanzei and @mickmister, I re-requested dev review but I'm now seeing there were not too many commits since last round. 1 dev re-review would probably have been plenty. Sorry I though Dev review approvals were much older as this task has been going for some time now.

Copy link
Contributor

@hanzei hanzei left a comment

Choose a reason for hiding this comment

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

A few new nitpicks

server/plugin/graphql/lhs_request.go Outdated Show resolved Hide resolved

if !flagAssignee {
for _, resp := range mainQuery.Assignee.Nodes {
resp := resp
Copy link
Contributor

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor Author

@Kshitij-Katiyar Kshitij-Katiyar Jul 5, 2023

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

The resp := resp looks a little off to me. Alternatively we could do this:

for i := range mainQuery.Assignee.Nodes {
    resp := mainQuery.Assignee.Nodes[i]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

server/plugin/graphql/lhs_request.go Outdated Show resolved Hide resolved
Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Thanks for this @Kshitij-Katiyar! I gave this another review. Nothing blocking, just leaving some comments

server/plugin/plugin.go Show resolved Hide resolved
server/plugin/api.go Outdated Show resolved Hide resolved
server/plugin/graphql/lhs_request.go Outdated Show resolved Hide resolved
server/plugin/graphql/lhs_request.go Outdated Show resolved Hide resolved
server/plugin/graphql/lhs_request.go Outdated Show resolved Hide resolved
break
}

if err := c.executeQuery(ctx, &mainQuery, params); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we ever fetching duplicate data here? e.g. If flagOpenPR is true, do we still request some PR data from GitHub?

Copy link
Contributor Author

@Kshitij-Katiyar Kshitij-Katiyar Jul 7, 2023

Choose a reason for hiding this comment

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

There could be a time when one of the 3 is nil but other entry still have some data to fetch. In that case we still need to call the API as we want to get the other part of the data and there is only 1 API call and a single query happening here. @mickmister

Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Just a few more naming suggestions

server/plugin/graphql/lhs_request.go Outdated Show resolved Hide resolved
server/plugin/graphql/lhs_query.go Outdated Show resolved Hide resolved
server/plugin/graphql/lhs_query.go Outdated Show resolved Hide resolved
server/plugin/graphql/lhs_query.go Outdated Show resolved Hide resolved
Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

I accidentally approved sorry about that. Please see the requested changes above

@mickmister
Copy link
Contributor

@DHaussermann Can you please give this another pass when you have the chance? cc @mkdbns

@mickmister mickmister removed the 2: Dev Review Requires review by a core committer label Jul 12, 2023
Copy link

@DHaussermann DHaussermann left a comment

Choose a reason for hiding this comment

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

Tested and passed

  • Repeated testing
  • Counts update
  • Refresh option is functional
  • Still no sign of rate limit issue in logs

LGTM!

@DHaussermann DHaussermann added 4: Reviews Complete All reviewers have approved the pull request and removed 3: QA Review Requires review by a QA tester labels Jul 18, 2023
@mickmister mickmister merged commit 3ea161c into mattermost:master Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request Contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API rate limit exceeded for user ID
9 participants