mirror of
https://github.com/miniflux/v2.git
synced 2025-07-02 16:38:37 +00:00
Delay call of view.New
after logging the user in
There is no need to do extra work like creating a session and its associated view until the user has been properly identified and as many possibly-failing sql request have been successfully run.
This commit is contained in:
parent
d55b410800
commit
8d80e9103f
15 changed files with 37 additions and 53 deletions
|
@ -19,10 +19,6 @@ import (
|
|||
|
||||
func (h *handler) showUnreadPage(w http.ResponseWriter, r *http.Request) {
|
||||
beginPreProcessing := time.Now()
|
||||
|
||||
sess := session.New(h.store, request.SessionID(r))
|
||||
view := view.New(h.tpl, r, sess)
|
||||
|
||||
user, err := h.store.UserByID(request.UserID(r))
|
||||
if err != nil {
|
||||
html.ServerError(w, r, err)
|
||||
|
@ -59,6 +55,8 @@ func (h *handler) showUnreadPage(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
finishSqlFetchUnreadEntries := time.Now()
|
||||
|
||||
sess := session.New(h.store, request.SessionID(r))
|
||||
view := view.New(h.tpl, r, sess)
|
||||
view.Set("entries", entries)
|
||||
view.Set("pagination", getPagination(route.Path(h.router, "unread"), countUnread, offset, user.EntriesPerPage))
|
||||
view.Set("menu", "unread")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue