Skip to content

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
Copy link
Member

@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 :)

@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
@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
Member

@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
Member

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
Member

@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
@gatsbyz gatsbyz deleted the jesse/monitor-process-batch-concurrently branch January 10, 2024 15:26
shadow-coder460o added a commit to shadow-coder460o/polygon-cli that referenced this pull request Sep 30, 2025
* concurrent processing of get blocks. batches by 50 default

* fix error

* lock on error value

* leo comments

* add lock

* block info

* Update cmd/monitor/monitor.go

leo changes

Co-authored-by: Léo Vincent <[email protected]>

* final changes to monitor

* fix: 0xPolygon/polygon-cli#181 (review)

---------

Co-authored-by: Léo Vincent <[email protected]>
Co-authored-by: John Hilliard <[email protected]>
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.

4 participants