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

A few fixes needing to be pushed to prod #282

Merged
merged 27 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
aa47002
Minor cleanups, fixing some todos
May 21, 2024
9d2b0c1
clearing up plugins
May 21, 2024
f83df9b
Handle a couple issues that were remaining
May 21, 2024
284c20f
Merge pull request #274 from porters-xyz/todo-cleanup
wtfsayo May 22, 2024
1ded77b
move to nanoid for tenant, user, apps!
wtfsayo May 22, 2024
9e300f1
added types
wtfsayo May 22, 2024
3b55ef6
fix es compatible version!
wtfsayo May 22, 2024
d0ab4c9
made appid copyable
wtfsayo May 22, 2024
89a823c
relay units!
wtfsayo May 22, 2024
afa1e47
smol attempt in network change fix
wtfsayo May 22, 2024
3dddf09
typo fix
wtfsayo May 22, 2024
15c21ad
save progress on invoice
wtfsayo May 22, 2024
bfacef5
save invoice progress
wtfsayo May 22, 2024
ecee808
nearly there, font pending!
wtfsayo May 22, 2024
9c139c5
update font!
wtfsayo May 22, 2024
c9f8acd
remove button!
wtfsayo May 22, 2024
dac69a2
updated const!
wtfsayo May 22, 2024
8b2b19e
Merge pull request #275 from porters-xyz/nanoid-update
wtfsayo May 22, 2024
8c0cea1
Merge pull request #279 from porters-xyz/george-feedback
wtfsayo May 22, 2024
7da5c4b
github build fixes!
wtfsayo May 22, 2024
4563b4a
Switched staging gateway url
May 23, 2024
4cd4b4c
Merge pull request #280 from porters-xyz/staging-change
wtfsayo May 23, 2024
045828f
just ts and nextjs build things
wtfsayo May 23, 2024
90bc21b
Merge pull request #281 from porters-xyz/frontend-build-fixes-round-1
wtfsayo May 23, 2024
2d70a7d
Report rate limit events to prometheus gauge
May 23, 2024
b0d74b5
fix balance thing! convert to number first
wtfsayo May 23, 2024
8aef6d5
Merge pull request #283 from porters-xyz/rate-limit-notification
wtfsayo May 24, 2024
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
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ services:
- porters-redis:/data

kit:
image: ghcr.io/pokt-network/pocket-gateway-server:0.1.0-BETA
image: ghcr.io/pokt-network/pocket-gateway-server:0.3.0
volumes:
- ./.env:/app/.env
ports:
Expand Down
5 changes: 5 additions & 0 deletions gateway/common/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
TENANT = "tenant"
QUEUE = "queue"
STAGE = "stage"
RATE_LIMIT = "rateLimit"
)

var (
Expand All @@ -30,4 +31,8 @@ var (
Help: "Shows how much the proxy process is adding to request",
Buckets: prometheus.ExponentialBucketsRange(float64(10 * time.Millisecond), float64(20 * time.Second), 10),
}, []string{STAGE})
RateLimitGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "gateway_rate_limit_hit",
Help: "Shows rate limits hit on a gauge, resets to 0 when resolved",
}, []string{APP, TENANT, RATE_LIMIT})
)
12 changes: 7 additions & 5 deletions gateway/common/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"time"
)

// TODO make it "pluggable" so different types of tasks can operate off queue

type Runnable interface {
error
Run()
Expand Down Expand Up @@ -57,7 +55,6 @@ func GetTaskQueue() *TaskQueue {
return qInst
}

// TODO include workers to clear out error channel
func (q *TaskQueue) SetupWorkers() {
numWorkers := GetConfigInt(NUM_WORKERS)
for i := 0; i < numWorkers; i++ {
Expand Down Expand Up @@ -117,7 +114,6 @@ func worker(q *TaskQueue) {
}
}

// TODO do more than log
func errWorker(q *TaskQueue) {
for err := range q.errors {
log.Error("error encountered", "err", err)
Expand All @@ -129,7 +125,6 @@ func delayWorker(q *TaskQueue) {
for i:=len(q.delayed); i>0; i-- {
task := <- q.delayed
if q.closed {
// TODO log delayed tasks details for cleanup
q.ReportError(errors.New("Shutting down"))
} else if task.Ready() {
q.Add(task)
Expand All @@ -141,6 +136,13 @@ func delayWorker(q *TaskQueue) {
time.Sleep(1 * time.Second)
}

func NewSimpleTask(run func()) *SimpleTask {
return &SimpleTask{
run: run,
runtime: time.Now(),
}
}

// SimpleTask can be extended if needed
func (t *SimpleTask) Run() {
t.run()
Expand Down
2 changes: 1 addition & 1 deletion gateway/common/tasks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestTask(t *testing.T) {
}
}

// TODO use this test to figure out the right blend
// this test can be tweaked to figure out the right blend
// combining is meant to compact multiple updates to redis into one
// rather than incr + incr + incr just do incrBy 3
// This costs a bit of compute and complicates the job queue
Expand Down
Loading