Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to go.mod mode and upgrade the redis dependency package,Improv… #4

Merged
merged 2 commits into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 152 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
### macOS template
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Windows template
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

### Go template
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

### Example user template template
### Example user template

# IntelliJ project files
.idea
*.iml
out
gen
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

Binary file modified bin/koala
100644 → 100755
Binary file not shown.
41 changes: 41 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Koala Rule Engine Core
*
* @package: main
* @desc: koala engine - Main router
*
* koala频率控制服务 (规则引擎)
* 用途:是为了解决用户提交等相关频率控制的一个通用服务,主要是为了替换传统写死代码的频率控制模块以达到 高性能、灵活配置的要求。
* 方案:支持高度灵活的规则配置;并实现了规则配置的动态加载; 后端cache采用带连接池的redis。
*
* @author: heiyeluren
* @github: https://github.com/heiyeluren
* @blog: https://blog.csdn.net/heiyeshuwu
*
*/

package main

import (
"github.com/heiyeluren/koala/koala"
)

/**
* koala服务进程的main函数
*/
func main() {
// Start koala
koala.Run()

// 启动 rule统计协程
go koala.CounterAgent()

// 启动 规则更新协程,定期检查 policy 更新
go koala.PolicyLoader()

// 启动 http监听协程
go koala.FrontListen()

// hold 住 main协程
select {}
}
10 changes: 5 additions & 5 deletions conf/koala.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ externalWriteTimeout = 500
#--------------

#redis服务地址
redis_server = 127.0.0.1:3721
redis_server = 127.0.0.1:6379

#redis服务password
redis_auth = Yhs8jCfcys
redis_auth =

#redis连接池,最大空闲连接数
redis_pool_maxIdle = 5
Expand All @@ -52,10 +52,10 @@ log_warning_file_path = log/koala.log.wf
log_cron_time = day

#日志文件生存周期, 单位:天
log_file_ilfe_time = 7
log_file_life_time = 7

#日志chan队列的buffer长度,建议不要少于10240,不建议多于1024000,最长:67021478(超过这个值会无法启动)
log_chan_buff_size = 10240
#日志channel队列的buffer长度,建议不要少于10240,不建议多于1024000,最长:67021478(超过这个值会无法启动)
log_channel_buff_size = 10240

#日志刷盘的时间间隔,单位:毫秒,建议500~5000毫秒,建议不超过30秒
log_flush_timer = 1000
Expand Down
Loading