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

concurrent processing of get blocks. batches by 50 default #181

Merged
merged 10 commits into from
Jan 10, 2024

Conversation

gatsbyz
Copy link
Contributor

@gatsbyz gatsbyz commented Jan 3, 2024

some chains have limits for the max batch processing number. to solve this, concurrent fetching by batches in 50 is implemented.

@gatsbyz gatsbyz requested a review from leovct January 3, 2024 19:28
cmd/monitor/monitor.go Outdated Show resolved Hide resolved
cmd/monitor/monitor.go Outdated Show resolved Hide resolved
cmd/monitor/monitor.go Outdated Show resolved Hide resolved
cmd/monitor/monitor.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@leovct leovct left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just a few comments regarding data races and channels :)

cmd/monitor/monitor.go Outdated Show resolved Hide resolved
@gatsbyz gatsbyz requested a review from leovct January 4, 2024 17:32
@gatsbyz gatsbyz force-pushed the jesse/monitor-process-batch-concurrently branch from 5fbfc70 to dfa825b Compare January 4, 2024 17:58
cmd/monitor/monitor.go Outdated Show resolved Hide resolved
cmd/monitor/monitor.go Outdated Show resolved Hide resolved
cmd/monitor/monitor.go Outdated Show resolved Hide resolved
@gatsbyz gatsbyz requested a review from leovct January 5, 2024 13:35
@gatsbyz gatsbyz force-pushed the jesse/monitor-process-batch-concurrently branch from 61f1fce to f849992 Compare January 5, 2024 14:49
Copy link
Collaborator

@leovct leovct left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ ./polycli monitor --verbosity 700 --rpc-url https://polygon-rpc.com &> debug.txt
# it crashes after a few seconds

$ cat debug.txt
�[90m10:56AM�[0m �[35mTRC�[0m Starting logger in console mode
�[90m10:56AM�[0m �[33mDBG�[0m Using fake peer count �[36merror=�[0m�[31m"the method net_peerCount does not exist/is not available"�[0m
�[90m10:56AM�[0m �[33mDBG�[0m Fetching blocks �[36mChainID=�[0m137 �[36mGasPrice=�[0m93919755129 �[36mHeadBlock=�[0m52079176 �[36mPeerCount=�[0m0
�[90m10:56AM�[0m �[33mDBG�[0m Auto-adjusted batchSize to 200 based on cache limit
�[90m10:56AM�[0m �[33mDBG�[0m Redrawing �[36mBatchSize=�[0m200 �[36mChainID=�[0m137 �[36mGasPrice=�[0m93919755129 �[36mHeadBlock=�[0m52079176 �[36mLowerBlock=�[0m<nil> �[36mPeerCount=�[0m0 �[36mPendingCount=�[0m64165 �[36mTopDisplayedBlock=�[0m52079176 �[36mUpperBlock=�[0m<nil>
panic: close of closed channel

goroutine 48 [running]:
github.com/maticnetwork/polygon-cli/cmd/monitor.(*monitorStatus).processBatchesConcurrently.func1.1()
	/Users/leovct/Documents/work/cli/polycli/cmd/monitor/monitor.go:321 +0x59
github.com/maticnetwork/polygon-cli/cmd/monitor.(*monitorStatus).processBatchesConcurrently.func1(0x0)
	/Users/leovct/Documents/work/cli/polycli/cmd/monitor/monitor.go:353 +0x68f
created by github.com/maticnetwork/polygon-cli/cmd/monitor.(*monitorStatus).processBatchesConcurrently in goroutine 67
	/Users/leovct/Documents/work/cli/polycli/cmd/monitor/monitor.go:317 +0xd1

@praetoriansentry
Copy link
Contributor

image
The initial load looks odd. I'd like to clean that up. I might take a shot.

@gatsbyz gatsbyz requested a review from leovct January 10, 2024 01:36
Copy link
Collaborator

@leovct leovct left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-01-10 at 09 41 25

@gatsbyz gatsbyz merged commit 822d658 into main Jan 10, 2024
6 checks passed
@gatsbyz gatsbyz deleted the jesse/monitor-process-batch-concurrently branch January 10, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants