Skip to content

Commit

Permalink
Fix code style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanIakovlev committed Dec 17, 2024
1 parent ec2b539 commit e93f5a0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
3 changes: 2 additions & 1 deletion ghcrawler/providers/queuing/storageQueue.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation and others. Made available under the MIT license.
// SPDX-License-Identifier: MIT

// eslint-disable-next-line no-unused-vars
const { QueueServiceClient } = require('@azure/storage-queue')
const qlimit = require('qlimit')
const { cloneDeep } = require('lodash')
Expand Down Expand Up @@ -31,7 +32,7 @@ class StorageQueue {
// No specific unsubscribe logic for Azure Queue Storage
}

async push(requests, option) {
async push(requests, _option) {

Check failure on line 35 in ghcrawler/providers/queuing/storageQueue.js

View workflow job for this annotation

GitHub Actions / Run tests

'_option' is defined but never used
requests = Array.isArray(requests) ? requests : [requests]
return Promise.all(
requests.map(
Expand Down
2 changes: 1 addition & 1 deletion ghcrawler/providers/queuing/storageQueueManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT

const AttenuatedQueue = require('./attenuatedQueue')
const { QueueServiceClient } = require('@azure/storage-queue')
const { QueueServiceClient, StorageRetryPolicyType } = require('@azure/storage-queue')
const Request = require('../../lib/request')
const StorageQueue = require('./storageQueue')
const { DefaultAzureCredential } = require('@azure/identity')
Expand Down
16 changes: 5 additions & 11 deletions ghcrawler/providers/storage/storageDocStore.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

const { BlobServiceClient } = require('@azure/storage-blob')
// eslint-disable-next-line no-unused-vars
const { ContainerClient } = require('@azure/storage-blob')
const memoryCache = require('memory-cache')
const { Readable } = require('stream')
Expand Down Expand Up @@ -95,26 +95,20 @@ class AzureStorageDocStore {
async count(type, force = false) {
this._ensureDeadletter(type)
const key = `${this.name}:count:${type || ''}`

if (!force) {
const cachedCount = memoryCache.get(key)
if (cachedCount) {
return cachedCount
}
}

let entryCount = 0
const properties = await this.containerClient.getProperties()
properties.blobCount
try {
for await (const blob of this.containerClient.listBlobsFlat()) {
entryCount++
}
memoryCache.put(key, entryCount, 60000)
return entryCount
} catch (error) {
throw error
for await (const _blob of this.containerClient.listBlobsFlat()) {

Check failure on line 107 in ghcrawler/providers/storage/storageDocStore.js

View workflow job for this annotation

GitHub Actions / Run tests

'_blob' is assigned a value but never used
entryCount++
}
memoryCache.put(key, entryCount, 60000)
return entryCount
}

async close() {
Expand Down
1 change: 0 additions & 1 deletion providers/store/azureQueueStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

const { DefaultAzureCredential } = require('@azure/identity')
const { QueueServiceClient, StorageRetryPolicyType } = require('@azure/storage-queue')
const { promisify } = require('util')

class AzureStorageQueue {
constructor(options) {
Expand Down

0 comments on commit e93f5a0

Please sign in to comment.