- Export the func
- Remove commented-out code
- Use log, not fmt for debug messages
- Remove named return parameters
- Use standard var naming schemes
- Fix spacing in queries and remove unnecessary chars
Previously, loading something like /invite/fFdblk😄 would return a 500,
due to a mix of collations in MySQL while SELECTing for an invite with
an ID of 'fFdblk😄'. This restricts the route to [a-zA-Z0-9] chars, to
prevent this.
Posts without an explicit title render the date as the post header in
lists of posts (like on the blog index and tag pages). This updates
localdate.js to properly adjust those dates, too.
This gets rid of the gorilla/context dependency, which might have been
causing a memory leak.
We noticed some serious memory leakage on Write.as that seemed to point
to this library. One heap snapshot:
flat flat% sum% cum cum%
259.13MB 30.41% 30.41% 268.13MB 31.46% net/textproto.(*Reader).ReadMIMEHeader
105.71MB 12.40% 42.81% 105.71MB 12.40% github.com/gorilla/context.Set
78.53MB 9.21% 52.03% 125.53MB 14.73% github.com/gorilla/sessions.(*Registry).Get
55.51MB 6.51% 58.54% 82.52MB 9.68% net/http.(*Request).WithContext
38.01MB 4.46% 63.00% 38.01MB 4.46% github.com/gorilla/mux.extractVars
35MB 4.11% 67.11% 53MB 6.22% context.WithCancel
34.50MB 4.05% 71.16% 34.50MB 4.05% context.WithValue
27MB 3.17% 74.32% 27MB 3.17% net/http.cloneURL
26MB 3.05% 77.38% 26MB 3.05% github.com/gorilla/sessions.NewSession
18MB 2.11% 79.49% 18MB 2.11% context.(*cancelCtx).Done
16.50MB 1.94% 81.42% 16.50MB 1.94% syscall.anyToSockaddr
14MB 1.64% 83.07% 47MB 5.52% github.com/gorilla/sessions.(*CookieStore).New
13.50MB 1.58% 84.65% 51.51MB 6.04% github.com/gorilla/mux.(*Route).Match
11.67MB 1.37% 86.02% 13.21MB 1.55% regexp.(*Regexp).replaceAll
9.72MB 1.14% 87.16% 22.94MB 2.69% regexp.(*Regexp).ReplaceAllString
9.50MB 1.11% 88.28% 115.21MB 13.52% github.com/gorilla/sessions.GetRegistry
With the help of these articles, we tracked it down to this dependency,
and upgraded the library, which seems to have completely fixed the issue
so far:
https://rover.rocks/golang-memory-leak/https://medium.com/@walterwu_22843/golang-memory-leak-while-handling-huge-amount-of-http-request-35cc970cb75e
This should fix#133
changes accounted for
- the tar directory structure had changed to use a subdirectory
- there are now multiple linux targets released
bugs
- the service must be stopped before replacing the binary
- migrations were not being run during an upgrade
Previously, anyone could access the editor even if they weren't logged
in. They couldn't do much in that case (publishing would fail), but it
could potentially cause some confusion.
Now, users will be sent to the login page, and then redirected back to
the editor once successfully logged in.