-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat(gzip): add gzip compression on update bot #137
base: develop
Are you sure you want to change the base?
Conversation
@@ -1,6 +1,7 @@ | |||
|
|||
import { JsonObject, Component } from "merapi"; | |||
import { IHelper } from "interfaces/main"; | |||
const pkg = require("../../package.json"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ak kurang yakin apakah kita benar2 perlu ini 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ini buat ambil sourcing version nya kan?
this.timeout = this.helper.getProp("timeout") as number || 300000; | ||
this.gzip = this.helper.getProp("gzip") as string || "false"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ini seperti hidden features di sini 😂
mungkin kita perlu mendokumentasikannya lebih baik untuk options yg bisa dipakai oleh user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iya. aku kepikiran ide, kalo saat push
, file size nya dibaca dulu, baru user bs milih mau di push pake di-compress atau nggak, gimana mas? wkkk
this.spinner = ora({ | ||
discardStdin: false, | ||
spinner: "line", | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ini untuk progress barnya. ak memilih spinner yg line
karena hanya itu saja yg disupport di Windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iya gpp lah mas. padahal yg dots lebih ai-ketching ya lol
const url = `${this.api.apiClient.basePath}/projects/${projectId}/bot/revisions/${latestBotRevision}`; | ||
const requestConfig: AxiosRequestConfig = { | ||
headers: { | ||
"Authorization": this.api.bearer.apiKey, | ||
"user-agent": `kata-cli@${this.api.version}`, | ||
}, | ||
timeout: this.api.timeout, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kita pke axios untuk custom requestnya. agak tedious pada saat ngebuild url nya
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gpp mas, sementara gini aja dulu. nanti di kata-cli yg baru dibikin schema api call buat axios request nya biar g tedious
const botString = JSON.stringify(data); | ||
headers["content-encoding"] = "deflate"; | ||
headers["content-type"] = "application/json"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
api gateway kita perlu dua headers ini supaya bisa decompress data yg terkirim
const botString = JSON.stringify(data); | ||
headers["content-encoding"] = "deflate"; | ||
headers["content-type"] = "application/json"; | ||
const gzip = zlib.deflateSync(botString, { }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kita menggunakan stdlib compression punya nodejs karena saat ini api gateway kita masih belum bisa handle compression dari library lain
@@ -0,0 +1,83 @@ | |||
{ | |||
"name": "kata-cli", | |||
"version": "2.5.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ini harusnya 2.5.1, bs di tsc lagi dulu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aku ada reply
this PR will add gzip compression on update bot method. Why use gzip on update bot? Sometimes our users have enormous size of bot definitions and the http library (on zaun library) only has 60sec timeout by default (sadly we can't change it tho). Thus we need to change the update bot mechanism using another http client library