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

performance improvements #69

Merged
merged 1 commit into from
Apr 27, 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
33 changes: 20 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"react-dom": "^17.0.2",
"react-json-view": "^1.21.1",
"react-router-dom": "^5.2.0",
"server-timing": "^3.3.1",
"uuid": "^8.1.0"
}
}
16 changes: 12 additions & 4 deletions src/client/kafka/messages/fetcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ export class Fetcher extends React.Component<Props, State> {
await this.updateSearch()
if (cancelToken.Aborted) return
this.props.url.Subscribe(this.onUrlChanged)
await this.fetchMessages(10000, cancelToken)
let timeout = 10000
if (this.state.limit && this.state.limit > 100) {
timeout = 20000
}
await this.fetchMessages(timeout, cancelToken)
}

onFetchMessagesClicked = async () => {
Expand Down Expand Up @@ -238,7 +242,11 @@ export class Fetcher extends React.Component<Props, State> {
if (offsets === undefined) {
return
}
await this.setStateAsync({offset: parseInt(offsets.high) - this.state.limit})
let offset = parseInt(offsets.high) - this.state.limit
if (offset < parseInt(offsets.low)) {
offset = parseInt(offsets.low)
}
await this.setStateAsync({offset})
out = await this.fetchMessagesForPartition(topic, timeout, partition, out, cancelToken)
}
}
Expand Down Expand Up @@ -321,8 +329,8 @@ export class Fetcher extends React.Component<Props, State> {
}
const max = cursor + this.state.limit
let limit = this.state.limit
if (limit > 1000) {
limit = 1000
if (limit > 10000) {
limit = 10000
}
if (cursor >= max) {
this.props.onDataFetched(out)
Expand Down
2 changes: 1 addition & 1 deletion src/client/kafka/messages/multi_topics_input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class MultiTopicsInput extends React.Component<Props, State> {
toTime={this.props.toTime}
searchBy={this.props.searchBy}
onDataFetched={this.props.onDataFetched}
onDataFetchStarted={() => { this.setState({loadingMessages: true}); this.props.onDataFetchStarted} }
onDataFetchStarted={() => { this.setState({loadingMessages: true}); this.props.onDataFetchStarted(AllPartitions)} }
onDataFetchCompleted={() => this.setState({loadingMessages: false})}
loadingMessages={this.state.loadingMessages}
error={this.state.error ?? ""}
Expand Down
2 changes: 1 addition & 1 deletion src/client/kafka/messages/single_topic_input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class SingleTopicInput extends React.Component<Props, State> {
toTime={this.props.toTime}
searchBy={this.props.searchBy}
onDataFetched={this.props.onDataFetched}
onDataFetchStarted={() => { this.setState({loadingMessages: true}); this.props.onDataFetchStarted} }
onDataFetchStarted={() => { this.setState({loadingMessages: true}); this.props.onDataFetchStarted(this.state.partition)} }
onDataFetchCompleted={() => this.setState({loadingMessages: false})}
loadingMessages={this.state.loadingMessages}
error={this.state.error ?? ""}
Expand Down
Loading