pub async fn get_next_queued_verification_request(
        &mut self,
        processing_timeout: Duration,
    ) -> DalResult<Option<(VerificationRequest, EtherscanVerification)>> {
        let processing_timeout = PgInterval {
            months: 0,
            days: 0,
            microseconds: processing_timeout.as_micros() as i64,
        };
        let result = sqlx::query_as!(
            StorageEtherscanVerificationRequest,
            r#"
            UPDATE etherscan_verification_requests evr
            SET
                status = 'in_progress',
                updated_at = NOW(),
                processing_started_at = NOW()
            FROM contract_verification_requests cvr
            WHERE
                evr.contract_verification_request_id = (
                    SELECT contract_verification_request_id
                    FROM etherscan_verification_requests
                    WHERE
                        (
                            (status = 'queued' AND (retry_at IS NULL OR retry_at < NOW()))
                            OR (
                                status = 'in_progress'
                                AND processing_started_at < NOW() - $1::INTERVAL
                            )
                        )
                    ORDER BY created_at
                    LIMIT 1
                    FOR UPDATE SKIP LOCKED
                )
                AND evr.contract_verification_request_id = cvr.id
            RETURNING
            cvr.id,
            cvr.contract_address,
            cvr.source_code,
            cvr.contract_name,
            cvr.zk_compiler_version,
            cvr.compiler_version,
            cvr.optimization_used,
            cvr.optimizer_mode,
            cvr.constructor_arguments,
            cvr.is_system,
            cvr.force_evmla,
            cvr.evm_specific,
            evr.etherscan_verification_id,
            evr.attempts,
            evr.retry_at
            "#,
            &processing_timeout
        )
        .instrument("get_next_queued_verification_request")
        .with_arg("processing_timeout", &processing_timeout)
        .fetch_optional(self.storage)
        .await?
        .map(Into::into);
        Ok(result)
    }
Returns the next verification request that is to be sent to Etherscan. Selects the request id from
etherscan_verification_requests and then returns the actual request from joined contract_verification_requests.
Handles the situation where processing of some request can be interrupted (panic, pod restart, etc..),
`processing_timeout` parameter is used to avoid stuck requests.
core/lib/dal/src/etherscan_verification_dal.rs