<commit_before>import * as express from 'express';
var azure = require('azure-sb')


async function receiveMessage(queueName: string): Promise<any> {

    return new Promise<any>((resolve, reject) => {
        var connStr = decodeURIComponent(process.env.BUS_CONN);
        var sbService = azure.createServiceBusService(connStr);

        let options = {
            isPeekLock: false,
            timeoutIntervalInS: 1,
         }

        sbService.receiveQueueMessage(queueName, options, function (err, lockedMessage) {
                if (err) {
                    if (err == 'No messages to receive') {
                        console.log('No messages');
                        resolve(null);
                    } else {
                        reject(err);
                    }
                } else {
                    resolve(lockedMessage);
                }
            });
    });
}

// function processMessage(sbService, err, lockedMsg) {
//   if (err) {
//     console.log('Error on Rx: ', err);
//   } else {
//     console.log('Rx: ', lockedMsg);
//     sbService.deleteMessage(lockedMsg, function(err2) {
//       if (err2) {
//         console.log('Failed to delete message: ', err2);
//       } else {
//         console.log('Deleted message.');
//       }
//     })
//   }
// }

function sendMessage(queueName: string, message: string) {

    var connStr = decodeURIComponent(process.env.BUS_CONN);
    var sbService = azure.createServiceBusService(connStr);

    sbService.sendQueueMessage(queueName, message, function (err: any) {
        if (err) {
            console.log('Failed Tx: ', err);
        } else {
            console.log('Sent ' + message);
        }
    });
}


// if (!connStr) throw new Error('Must provide connection string');
// var queueName = 'sbqtest';

// console.log('Connecting to ' + connStr + ' queue ' + queueName);<commit_msg>change connection string env var name<commit_after>import * as express from 'express';
var azure = require('azure-sb')


let connStr = decodeURIComponent(process.env.SERVICE_BUS_CONNECTION_STRING);

async function receiveMessage(queueName: string): Promise<any> {

    return new Promise<any>((resolve, reject) => {
        var sbService = azure.createServiceBusService(connStr);

        let options = {
            isPeekLock: false,
            timeoutIntervalInS: 1,
        }

        sbService.receiveQueueMessage(queueName, options, function (err, lockedMessage) {
            if (err) {
                if (err == 'No messages to receive') {
                    console.log('No messages');
                    resolve(null);
                } else {
                    reject(err);
                }
            } else {
                resolve(lockedMessage);
            }
        });
    });
}

// function processMessage(sbService, err, lockedMsg) {
//   if (err) {
//     console.log('Error on Rx: ', err);
//   } else {
//     console.log('Rx: ', lockedMsg);
//     sbService.deleteMessage(lockedMsg, function(err2) {
//       if (err2) {
//         console.log('Failed to delete message: ', err2);
//       } else {
//         console.log('Deleted message.');
//       }
//     })
//   }
// }

function sendMessage(queueName: string, message: string) {


    var sbService = azure.createServiceBusService(connStr);

    sbService.sendQueueMessage(queueName, message, function (err: any) {
        if (err) {
            console.log('Failed Tx: ', err);
        } else {
            console.log('Sent ' + message);
        }
    });
}


// if (!connStr) throw new Error('Must provide connection string');
// var queueName = 'sbqtest';

// console.log('Connecting to ' + connStr + ' queue ' + queueName);
{'fraction_non_alphanumeric': 0.13722312263641276, 'fraction_numerical': 0.0021609940572663426, 'mean_word_length': 1.936558287073751, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6484063', 'n_tokens_mistral': 1057, 'n_tokens_neox': 1029, 'n_words': 229}