Closed ldeffenb closed 2 years ago
Each pass of createFileJob is intended to add cpuNUm (bad capitalization) "files" per pass. However...
When retrieving the recorded ID, it is incremented once after converting from a string https://github.com/bzznectar/nectar/blob/2bb1257cfb1bd6d9d0b8cc0e02a129ccba2a1781/pkg/task/task.go#L89
But then it is incremented AGAIN before invoking createFiles causing one of the _id values to be completely skipped. https://github.com/bzznectar/nectar/blob/2bb1257cfb1bd6d9d0b8cc0e02a129ccba2a1781/pkg/task/task.go#L95
This became obvious to me when I added a log of the IDs as they were being created and also removed the "go" from the invocation of createFiles. The IDs being created per pass was incrementing by 17 instead of the cpuNUm of 16 on my machine.
Incidentally, the entire required set of files created MUCH faster when simply invoking createFiles directly in the loop instead of passing them off to individual go routines due to the constant regression of the recorded id caused by lack of synchronization around https://github.com/bzznectar/nectar/blob/2bb1257cfb1bd6d9d0b8cc0e02a129ccba2a1781/pkg/task/task.go#L115
Thank you for your suggestion, it has been updated
Each pass of createFileJob is intended to add cpuNUm (bad capitalization) "files" per pass. However...
When retrieving the recorded ID, it is incremented once after converting from a string https://github.com/bzznectar/nectar/blob/2bb1257cfb1bd6d9d0b8cc0e02a129ccba2a1781/pkg/task/task.go#L89
But then it is incremented AGAIN before invoking createFiles causing one of the _id values to be completely skipped. https://github.com/bzznectar/nectar/blob/2bb1257cfb1bd6d9d0b8cc0e02a129ccba2a1781/pkg/task/task.go#L95
This became obvious to me when I added a log of the IDs as they were being created and also removed the "go" from the invocation of createFiles. The IDs being created per pass was incrementing by 17 instead of the cpuNUm of 16 on my machine.
Incidentally, the entire required set of files created MUCH faster when simply invoking createFiles directly in the loop instead of passing them off to individual go routines due to the constant regression of the recorded id caused by lack of synchronization around https://github.com/bzznectar/nectar/blob/2bb1257cfb1bd6d9d0b8cc0e02a129ccba2a1781/pkg/task/task.go#L115