<commit_before>import {JSONDBPeer} from "../../../../lib/db/DBPeer"
import {PeerDTO} from "../../../../lib/dto/PeerDTO"
import {Underscore} from "../../../../lib/common-libs/underscore"
import {BlockDTO} from "../../../../lib/dto/BlockDTO"
import {Watcher} from "./Watcher"
import {ISyncDownloader} from "./ISyncDownloader"
import {cliprogram} from "../../../../lib/common-libs/programOptions"
import {Keypair} from "../../../../lib/dto/ConfDTO"
import {IRemoteContacter} from "./IRemoteContacter"
import {ManualPromise} from "../../../../lib/common-libs/manual-promise"
import {GlobalFifoPromise} from "../../../../service/GlobalFifoPromise"
import {getNanosecondsTime} from "../../../../ProcessCpuProfiler"
import {CommonConstants} from "../../../../lib/common-libs/constants"
import {DataErrors} from "../../../../lib/common-libs/errors"
import {ASyncDownloader} from "./ASyncDownloader"
import {P2pCandidate} from "./p2p/p2p-candidate"

export class P2PSyncDownloader extends ASyncDownloader implements ISyncDownloader {

  private PARALLEL_PER_CHUNK = 1;
  private MAX_DELAY_PER_DOWNLOAD = cliprogram.slow ? 2 * 60000 : 5000;
  private TOO_LONG_TIME_DOWNLOAD:string
  private nbBlocksToDownload:number
  private numberOfChunksToDownload:number
  private processing:any
  private handler:any
  private p2pCandidates: P2pCandidate[] = []
  private nbDownloadsTried = 0
  private nbDownloading = 0
  private downloads: { [chunk: number]: P2pCandidate } = {}
  private fifoPromise = new GlobalFifoPromise()
  private nbWaitFailed = 0
<commit_msg>[fix] `sync`: Wait up to 15s for the downloading of a chunk in normal mode<commit_after>import {JSONDBPeer} from "../../../../lib/db/DBPeer"
import {PeerDTO} from "../../../../lib/dto/PeerDTO"
import {Underscore} from "../../../../lib/common-libs/underscore"
import {BlockDTO} from "../../../../lib/dto/BlockDTO"
import {Watcher} from "./Watcher"
import {ISyncDownloader} from "./ISyncDownloader"
import {cliprogram} from "../../../../lib/common-libs/programOptions"
import {Keypair} from "../../../../lib/dto/ConfDTO"
import {IRemoteContacter} from "./IRemoteContacter"
import {ManualPromise} from "../../../../lib/common-libs/manual-promise"
import {GlobalFifoPromise} from "../../../../service/GlobalFifoPromise"
import {getNanosecondsTime} from "../../../../ProcessCpuProfiler"
import {CommonConstants} from "../../../../lib/common-libs/constants"
import {DataErrors} from "../../../../lib/common-libs/errors"
import {ASyncDownloader} from "./ASyncDownloader"
import {P2pCandidate} from "./p2p/p2p-candidate"

export class P2PSyncDownloader extends ASyncDownloader implements ISyncDownloader {

  private PARALLEL_PER_CHUNK = 1;
  private MAX_DELAY_PER_DOWNLOAD = cliprogram.slow ? 2 * 60000 : 15000;
  private TOO_LONG_TIME_DOWNLOAD:string
  private nbBlocksToDownload:number
  private numberOfChunksToDownload:number
  private processing:any
  private handler:any
  private p2pCandidates: P2pCandidate[] = []
  private nbDownloadsTried = 0
  private nbDownloading = 0
  private downloads: { [chunk: number]: P2pCandidate } = {}
  private fifoPromise = new GlobalFifoPromise()
  private nbWaitFailed = 0

{'fraction_non_alphanumeric': 0.17395437262357413, 'fraction_numerical': 0.014258555133079848, 'mean_word_length': 3.7473684210526317, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 25, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5804', 'n_tokens_mistral': 1029, 'n_tokens_neox': 1001, 'n_words': 236}