Skip to content

Commit 343113f

Browse files
committed
disable etag cache
1 parent 747abcd commit 343113f

File tree

3 files changed

+36
-31
lines changed

3 files changed

+36
-31
lines changed

aiplan.go/internal/aiplan/editor/tiptap/nodes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func parseParagraph(node TipTapNode) *edtypes.Paragraph {
5959
p.Content = append(p.Content, hb)
6060
}
6161
default:
62-
slog.Warn("Unknown paragraph child type", "type", child.Type)
62+
slog.Debug("Unknown paragraph child type", "type", child.Type)
6363
}
6464
}
6565

aiplan.go/internal/aiplan/http-project.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,24 @@ func (s *Services) ProjectMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
5050
workspace := c.(WorkspaceContext).Workspace
5151
user := c.(WorkspaceContext).User
5252

53-
if etag := c.Request().Header.Get("If-None-Match"); etag != "" && c.Path() == "/api/auth/workspaces/:workspaceSlug/projects/:projectId/" {
54-
var exist bool
55-
if err := s.db.Model(&dao.Project{}).
56-
Select("EXISTS(?)",
57-
s.db.Model(&dao.Project{}).
58-
Select("1").
59-
Where("encode(hash, 'hex') = ?", etag),
60-
).
61-
Find(&exist).Error; err != nil {
62-
return EError(c, err)
63-
}
64-
65-
if exist {
66-
return c.NoContent(http.StatusNotModified)
67-
}
68-
}
53+
/*
54+
if etag := c.Request().Header.Get("If-None-Match"); etag != "" {
55+
var exist bool
56+
if err := s.db.Model(&dao.Project{}).
57+
Select("EXISTS(?)",
58+
s.db.Model(&dao.Project{}).
59+
Select("1").
60+
Where("encode(hash, 'hex') = ?", etag),
61+
).
62+
Find(&exist).Error; err != nil {
63+
return EError(c, err)
64+
}
65+
66+
if exist {
67+
return c.NoContent(http.StatusNotModified)
68+
}
69+
}
70+
*/
6971

7072
// Joins faster than Preload(clause.Associations)
7173
var project dao.Project

aiplan.go/internal/aiplan/http-workspace.go

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,25 @@ func (s *Services) WorkspaceMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
5858
user := c.(AuthContext).User
5959
slugOrId := c.Param("workspaceSlug")
6060

61-
if etag := c.Request().Header.Get("If-None-Match"); etag != "" && c.Path() == "/api/auth/workspaces/:workspaceSlug/" {
62-
var exist bool
63-
if err := s.db.Model(&dao.Workspace{}).
64-
Select("EXISTS(?)",
65-
s.db.Model(&dao.Workspace{}).
66-
Select("1").
67-
Where("encode(hash, 'hex') = ?", etag),
68-
).
69-
Find(&exist).Error; err != nil {
70-
return EError(c, err)
71-
}
61+
/*
62+
if etag := c.Request().Header.Get("If-None-Match"); etag != "" {
63+
etag = strings.TrimSuffix(etag, user.ID.String())
64+
var exist bool
65+
if err := s.db.Model(&dao.Workspace{}).
66+
Select("EXISTS(?)",
67+
s.db.Model(&dao.Workspace{}).
68+
Select("1").
69+
Where("encode(hash, 'hex') = ?", etag),
70+
).
71+
Find(&exist).Error; err != nil {
72+
return EError(c, err)
73+
}
7274
73-
if exist {
74-
return c.NoContent(http.StatusNotModified)
75+
if exist {
76+
return c.NoContent(http.StatusNotModified)
77+
}
7578
}
76-
}
79+
*/
7780

7881
var workspace dao.Workspace
7982
workspaceQuery := s.db.

0 commit comments

Comments
 (0)