Skip to content

Commit bd05656

Browse files
sdrasMaximRouiller
authored andcommitted
add repo/desc to package json to remove warnings, small optimizations for saverepo function
1 parent d473c9e commit bd05656

File tree

4 files changed

+48
-42
lines changed

4 files changed

+48
-42
lines changed
Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
1-
const df = require("durable-functions");
2-
var storage = require('azure-storage');
1+
const df = require('durable-functions')
2+
var storage = require('azure-storage')
33

4-
module.exports = async function (context, input) {
5-
// `input` here is retrieved from the Orchestrator function `callActivityAsync` input parameter
4+
module.exports = async (context, input) => {
5+
// `input` here is retrieved from the Orchestrator function `callActivityAsync` input parameter
66

7-
// create the table service for Blob Storage
8-
var tableService = storage.createTableService(process.env['AzureWebJobsStorage']);
9-
10-
// create the table if it doesn't exist already.
11-
tableService.createTableIfNotExists('Repositories', function (error) {
12-
if (error) {
13-
console.error(error);
14-
}
15-
if (!error) {
16-
// creates a batch of operation to be executed
17-
var batch = new storage.TableBatch();
18-
for (var i = 0; i < input.length; i++) {
19-
var repository = input[i];
7+
// create the table service for Blob Storage
8+
var tableService = storage.createTableService(
9+
process.env['AzureWebJobsStorage']
10+
)
2011

21-
// Creates an operation to add the repository to Table Storage
22-
batch.insertOrReplaceEntity({
23-
PartitionKey: {'_': 'Default'},
24-
RowKey: {'_': repository.id.toString()},
25-
OpenedIssues: {'_': repository.openedIssues},
26-
RepositoryName: {'_': repository.name}
27-
});
28-
}
29-
// execute the batch of operations
30-
tableService.executeBatch('Repositories', batch, function (error, result, response) {
31-
if (error) {
32-
console.error(error);
33-
}
34-
});
35-
}
36-
});
37-
};
12+
// create the table if it doesn't exist already.
13+
tableService.createTableIfNotExists('Repositories', error => {
14+
if (error) {
15+
console.error(error)
16+
return
17+
}
18+
// creates a batch of operation to be executed
19+
var batch = new storage.TableBatch()
20+
for (var i = 0; i < input.length; i++) {
21+
var repository = input[i]
22+
23+
// Creates an operation to add the repository to Table Storage
24+
batch.insertOrReplaceEntity({
25+
PartitionKey: { _: 'Default' },
26+
RowKey: { _: repository.id.toString() },
27+
OpenedIssues: { _: repository.openedIssues },
28+
RepositoryName: { _: repository.name }
29+
})
30+
}
31+
// execute the batch of operations
32+
tableService.executeBatch('Repositories', batch, error => {
33+
if (error) {
34+
console.error(error)
35+
}
36+
})
37+
})
38+
}

FanOutFanInCrawler/local.settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"FUNCTIONS_WORKER_RUNTIME": "node",
55
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
66
"AzureWebJobsDashboard": "UseDevelopmentStorage=true",
7-
"GitHubToken": "TOKEN HERE"
7+
"GitHubToken": "8c183799584a3ee80482e01c880ff0c15b418de9"
88
}
9-
}
9+
}

FanOutFanInCrawler/package-lock.json

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FanOutFanInCrawler/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
22
"name": "fanoutfanincrawler",
33
"version": "1.0.0",
4-
"description": "",
4+
"description": "Demo to show Durable Functions with Fan out Fan in Pattern",
55
"author": "MaximRouiller",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/Azure-Samples/durablefunctions-apiscraping-nodejs"
9+
},
610
"license": "ISC",
711
"dependencies": {
812
"@octokit/rest": "^15.11.1",

0 commit comments

Comments
 (0)