Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeline reversed #28

Closed
xsanch opened this issue Jan 26, 2014 · 2 comments
Closed

Timeline reversed #28

xsanch opened this issue Jan 26, 2014 · 2 comments

Comments

@xsanch
Copy link

xsanch commented Jan 26, 2014

Not sure how and why but I get the timeline of the user normal feed reversed:

Below is the feed for the user with id 2, the first record is with ID 1000000074 while the smallest is actually 1000000064.

redis 127.0.0.1:6379> zrevrange feed:normal:2 0 100

  1. "13907862970001000000074005"
  2. "13907862960001000000073005"
  3. "13907862940001000000072005"
  4. "13907862930001000000071005"
  5. "13907862920001000000070005"
  6. "13907862910001000000069005"
  7. "13907862900001000000068005"
  8. "13907862890001000000067005"
  9. "13907862880001000000066005"
  10. "13907862870001000000065005"
  11. "13907862850001000000064005"

I am using the pinterest example as a base, here is my feedly setup:

from feedly.aggregators.base import RecentVerbAggregator
from feedly.feeds.redis import RedisFeed
from feedly.feeds.aggregated_feed.redis import RedisAggregatedFeed


class MMSFeed(RedisFeed):
    key_format = "feed:normal:%(user_id)s"


class AggregatedMMSFeed(RedisAggregatedFeed):
    aggregator_class = RecentVerbAggregator
    key_format = "feed:aggregated:%(user_id)s"


class UserMMSFeed(MMSFeed):
    key_format = "feed:user:%(user_id)s"

And here:

from feedly.feed_managers.base import Feedly
from feedly.feed_managers.base import FanoutPriority
from gruppu.models import Content, Stream
from gruppu.mms_feed import AggregatedMMSFeed, MMSFeed, \
    UserMMSFeed


class MMSFeedly(Feedly):
    # this example has both a normal feed and an aggregated feed (more like
    # how facebook or wanelo uses feeds)
    feed_classes = dict(
        normal=MMSFeed,
        aggregated=AggregatedMMSFeed
    )
    user_feed_class = UserMMSFeed

    def add_mms(self, pin):
        activity = pin.create_activity()
        # add user activity adds it to the user feed, and starts the fanout
        self.add_user_activity(pin.origstream_id, activity)

    def remove_mms(self,pin,user):
        activity = pin.create_activity()
    if user == pin.origstream.streamOwner:
            # removes the pin from the user's followers feeds
            self.remove_user_activity(pin.origstream_id, activity)
    else:
        for feed_class in self.feed_classes.values():
            user_feed = feed_class(user.id)
            user_feed.remove(activity)
    def get_user_follower_ids(self, activity, user_id):
    author = activity.extra_context['owner_id']
        ids = list(Stream.objects.filter(pk=user_id).values_list('groupers',flat=True))
    ids.append(author)
    print ids
        return {FanoutPriority.HIGH:ids}

feedly = MMSFeedly()
@xsanch xsanch closed this as completed Jan 26, 2014
@tschellenbach
Copy link
Owner

The first part is the timestamp, that actually doesn't look reversed :)

@xsanch
Copy link
Author

xsanch commented Jan 26, 2014

I just realized when I pushed the submit button, then it was too late .
Made dumb of myself, as usual .

Thanks,

Jorge

On Sun, Jan 26, 2014 at 2:42 PM, Thierry Schellenbach <
notifications@github.com> wrote:

The first part is the timestamp, that actually doesn't look reversed :)


Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-33329638
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants