add MongoDB,Redis,Kafka retry mechanism (#518)

This commit is contained in:
pluto
2023-07-13 12:26:09 +08:00
committed by GitHub
parent 7bf8a898e2
commit 058e2eee32
8 changed files with 167 additions and 59 deletions
+5 -4
View File
@@ -31,6 +31,7 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
)
// CorsHandler gin cross-domain configuration.
func CorsHandler() gin.HandlerFunc {
return func(c *gin.Context) {
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
@@ -39,19 +40,19 @@ func CorsHandler() gin.HandlerFunc {
c.Header(
"Access-Control-Expose-Headers",
"Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers,Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma,FooBar",
) // 跨域关键设置 让浏览器可以解析
) // Cross-domain key settings allow browsers to resolve.
c.Header(
"Access-Control-Max-Age",
"172800",
) // 缓存请求信息 单位为秒
) // Cache request information in seconds.
c.Header(
"Access-Control-Allow-Credentials",
"false",
) // 跨域请求是否需要带cookie信息 默认设置为true
) // Whether cross-domain requests need to carry cookie information, the default setting is true.
c.Header(
"content-type",
"application/json",
) // 设置返回格式是json
) // Set the return format to json.
//Release all option pre-requests
if c.Request.Method == http.MethodOptions {
c.JSON(http.StatusOK, "Options Request!")