Trying a Repository.persist() with a 100 entries array and getting an ER_LOCK_DEADLOCK error message. Does anyone else have this issue? How should I cope with that?
When trying to wrap it in a Repository.transaction() function I get the error "QueryRunnerAlreadyReleasedError: Query runner already released. Cannot run queries anymore."
public async bulkInsert(bulk: MyObject[]): Promise<any> {
return this.repository.persist(bulk).then((result) => {
console.log('result', result);
return result;
}, (error) => {
console.log('error', error);
This version gives me the ER_LOCK_DEADLOCK
public async bulkInsert(bulk: MyObject[]): Promise<any> {
return this.repository.transaction((repository) => {
repository.persist(bulk).then((result) => {
console.log('result', result);
return result;
}, (error) => {
console.log('error', error);
This version gives me QueryRunnerAlreadyReleasedError: Query runner already released. Cannot run queries anymore.
Was running on 0.0.11, tried to update to 0.1.0-alpha.10
but I get the error message Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'string NOT NULL) ENGINE=InnoDB' at line 1
on startup.
Database engine is MySQL 5.6.27
Can you try to add return
in your transaction:
public async bulkInsert(bulk: MyObject[]): Promise<any> {
return this.repository.transaction((repository) => {
return repository.persist(bulk).then((result) => {
console.log('result', result);
return result;
}, (error) => {
console.log('error', error);
});
});