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

Followups for shared calendar engine PR #267 #357

Open
mickmister opened this issue Mar 1, 2024 · 0 comments
Open

Followups for shared calendar engine PR #267 #357

mickmister opened this issue Mar 1, 2024 · 0 comments

Comments

@mickmister
Copy link
Contributor

As a follow up to #267, I've documented some left over cleanup items that mostly pre-existed in the codebase before that calendar migration PR.

  1. Consider removing unused commands

There are a few commands that, to my knowledge, are never used. Either because they are outside of the purpose of the plugin, or they require meticulous datetime formatting in the command arguments. Here are some that I noticed:

	case "createcal":
	case "createevent":
	case "deletecal":
	case "findmeetings":
	case "showcals":
	case "events":
	case "avail":
	case "subscribe":
	case "unsubscribe":

We'll want to delete these from the processed commands, and command autocomplete.

  1. In the EventResponder struct, there are 4 methods. One of the methods RespondToEvent essentially implements the other three, and those other three methods are never called and so are dead code. The methods not being called should be removed.

type EventResponder interface {
AcceptEvent(user *User, eventID string) error
DeclineEvent(user *User, eventID string) error
TentativelyAcceptEvent(user *User, eventID string) error
RespondToEvent(user *User, eventID, response string) error
}

  1. Document how the status sync job works. It's currently not obvious how the timing window stuff works at the code block below. It should be clear how big the window is and how close by to the event we want to calculate certain things.

const (
calendarViewTimeWindowSize = 10 * time.Minute
StatusSyncJobInterval = 5 * time.Minute
upcomingEventNotificationTime = 10 * time.Minute
upcomingEventNotificationWindow = (StatusSyncJobInterval * 11) / 10 // 110% of the interval
logTruncateMsg = "We've truncated the logs due to too many messages"
logTruncateLimit = 5
)

  1. Logging in the renew job is excessive - We create a log message for every connected user whenever the renew job runs. We should consider the value in this. Maybe we should only log on error logging during renew job seems overkill

for _, u := range uindex {
asUser := engine.New(env, u.MattermostUserID)
env.Logger.Debugf("Renewing for user: %s", u.MattermostUserID)

  1. There are references to mscalendar in the plugin setup. It should be made more agnostic like pluginBot instead of mscalendarBot

mscalendarBot := engine.NewMSCalendarBot(e.bot, e.Env, pluginURL)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant