Skip to content
This repository was archived by the owner on Jul 19, 2020. It is now read-only.
This repository was archived by the owner on Jul 19, 2020. It is now read-only.

Tweets appear immediately, Follower only after 2 minutes (first job execution) #14

Open
@sesu85

Description

@sesu85

Hi everyone,
if I execute my dashing with this widget, I always get the Tweets by loading the page immediately, but the Followers only after first execution of the job, so after 2 minutes.
I already tried to reorder the commands, but always with the same result.
Has anyone an idea?
Thank you,
Sebastian

twitter_username = ENV['TWITTER_USERNAME'] || 'BWweissenstadt'

SCHEDULER.every '2m', :first_in => 0 do |job|
  doc = Nokogiri::HTML(open("https://twitter.com/#{twitter_username}"))
  followers = doc.css('a[data-nav=followers]').first.attributes['title'].value.split(' ').first
  send_event('twitter', follower: followers)  
  tweets = doc.css('a[data-nav=tweets]').first.attributes['title'].value.split(' ').first
  tweets << " Tweets"
  send_event('twitter', tweet: tweets)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions