You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
query and exec calls hangs indefinitely when external network latency was introduced.
Steps to reproduce.
script:
import sql from "k6/x/sql";
// the actual database driver should be used instead of ramsql
import driver from "k6/x/sql/driver/mysql";
const db = sql.open(driver, "some-db");
export function setup() {
db.exec(`
CREATE TABLE IF NOT EXISTS roster
(
id INTEGER NOT NULL AUTOINCREMENT,
given_name VARCHAR NOT NULL,
family_name VARCHAR NOT NULL,
PRIMARY KEY (ID)
);
`);
}
export function teardown() {
db.close();
}
export default function () {
let result = db.exec(`
INSERT INTO roster_2
(given_name, family_name)
VALUES
('Peter', 'Pan'),
('Wendy', 'Darling'),
('Tinker', 'Bell'),
('James', 'Hook');
`);
console.log(`${result.rowsAffected()} rows inserted`);
let rows = db.query("SELECT * FROM roster WHERE given_name = $1;", "Peter");
for (const row of rows) {
console.log(`${row.family_name}, ${row.given_name}`);
}
}
@sharathjag , Yes, I saw that. Context handling and timeout require a bit more thought, so I didn't include it in the release. I'll continue to think about it.
agreed, it needs a little more thought.
I was debating b/w passing vu object to db, I didn't like it either.
May be add a module level method to get the context?
query and exec calls hangs indefinitely when external network latency was introduced.
Steps to reproduce.
script:
We have a fix on our fork https://github.com/sharathjag/xk6-sql/blob/conn-options-with-timeouts/sql/module.go#L275
Happy to refine and open PR if the general direction makes sense. Please, keep me posted.
Also see: grafana/k6#3958 (comment)
The text was updated successfully, but these errors were encountered: