server: don't take mutex lock where not necessary
Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
parent
0c38f94c8f
commit
98ae532e26
1 changed files with 0 additions and 6 deletions
|
@ -93,8 +93,6 @@ func (s *server) router(res http.ResponseWriter, req *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
s.mu.RLock()
|
|
||||||
defer s.mu.RUnlock()
|
|
||||||
for _, p := range s.postList {
|
for _, p := range s.postList {
|
||||||
if p.Slug == slug {
|
if p.Slug == slug {
|
||||||
s.postPage(p, res, req)
|
s.postPage(p, res, req)
|
||||||
|
@ -145,8 +143,6 @@ func (s *server) homePage(res http.ResponseWriter, req *http.Request) {
|
||||||
|
|
||||||
var posts string
|
var posts string
|
||||||
|
|
||||||
s.mu.RLock()
|
|
||||||
defer s.mu.RUnlock()
|
|
||||||
for _, p := range s.postList {
|
for _, p := range s.postList {
|
||||||
summary, err := p.render(s.templates["summary"])
|
summary, err := p.render(s.templates["summary"])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -165,8 +161,6 @@ func (s *server) homePage(res http.ResponseWriter, req *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) loadStylesheet(res http.ResponseWriter, req *http.Request, filename string) (ok bool) {
|
func (s *server) loadStylesheet(res http.ResponseWriter, req *http.Request, filename string) (ok bool) {
|
||||||
s.mu.RLock()
|
|
||||||
defer s.mu.RUnlock()
|
|
||||||
contents, ok := s.styles[filename]
|
contents, ok := s.styles[filename]
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue