package generator

import (
	"socialapi/workers/helper"
	"socialapi/workers/sitemap/common"
)

type FileSelector interface {
	Select() (string, error)
}

type SimpleFileSelector struct{}

func (s SimpleFileSelector) Select() (string, error) {
	return "sitemap", nil
}

type CachedFileSelector struct{}

func (s CachedFileSelector) Select() (string, error) {
	redisConn := helper.MustGetRedisConn()

	item, err := redisConn.PopSetMember(common.PrepareCurrentFileNameCacheKey())

	if err != nil {
		return "", err
	}

	return item, nil
}

package generator

import (
	"socialapi/workers/helper"
	"socialapi/workers/sitemap/common"

	"github.com/koding/redis"
)

type FileSelector interface {
	Select() (string, error)
}

type SimpleFileSelector struct{}

func (s SimpleFileSelector) Select() (string, error) {
	return "sitemap", nil
}

type CachedFileSelector struct{}

func (s CachedFileSelector) Select() (string, error) {
	redisConn := helper.MustGetRedisConn()

	item, err := redisConn.PopSetMember(common.PrepareCurrentFileNameCacheKey())

	if err != redis.ErrNil {
		return "", err
	}

	return item, err
}

--- 
+++ 
@@ -3,8 +3,6 @@
 import (
 	"socialapi/workers/helper"
 	"socialapi/workers/sitemap/common"
-
-	"github.com/koding/redis"
 )
 
 type FileSelector interface {
@@ -24,9 +22,9 @@
 
 	item, err := redisConn.PopSetMember(common.PrepareCurrentFileNameCacheKey())
 
-	if err != redis.ErrNil {
+	if err != nil {
 		return "", err
 	}
 
-	return item, err
+	return item, nil
 }
Sitemap: Fix sitemap items are not generated bug
