Remove useless transaction block

This commit is contained in:
Alessio 2021-08-22 18:20:42 -07:00
parent 1dc9511415
commit 9c944cdc5e
2 changed files with 2 additions and 12 deletions

View File

@ -39,8 +39,6 @@ func main() {
return
}
var err error
profile, err = persistence.LoadProfile(*profile_dir)
if err != nil {
@ -211,6 +209,7 @@ func fetch_user_feed(handle string) {
fmt.Printf("Saved %d tweets, %d retweets and %d users. Exiting successfully\n", len(tweets), len(retweets), len(users))
}
func download_tweet_content(tweet_id string) {
id, err := strconv.Atoi(tweet_id)
if err != nil {

View File

@ -16,11 +16,7 @@ import (
func (p Profile) SaveUser(u scraper.User) error {
db := p.DB
tx, err := db.Begin()
if err != nil {
return err
}
_, err = db.Exec(`
_, err := db.Exec(`
insert into users (id, display_name, handle, bio, following_count, followers_count, location, website, join_date, is_private, is_verified, profile_image_url, profile_image_local_path, banner_image_url, banner_image_local_path, pinned_tweet_id, is_content_downloaded)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
on conflict do update
@ -45,11 +41,6 @@ func (p Profile) SaveUser(u scraper.User) error {
return err
}
err = tx.Commit()
if err != nil {
return err
}
return nil
}